[C#] 在Application Virtualizer內Run 一個 Installer

本帖最後由 luckiejacky 於 2016-12-17 20:28 編輯
  1. // create suspended process...
  2. NativeAPI.RtlCreateSuspendedProcess(
  3.                 InEXEPath,
  4.                 InCommandLine,
  5.                 InProcessCreationFlags,
  6.                 out RemotePID,
  7.                 out RemoteTID);
  8.   
  9. InjectEx(
  10.         NativeAPI.GetCurrentProcessId(),
  11.                 RemotePID,
  12.                     RemoteTID,
  13.                     0x20000000,
  14.                     InLibraryPath_x86,
  15.                     InLibraryPath_x64,
  16.                     true,
  17.                     false,
  18.                     InPassThruArgs);



  19. _process = PackagingProcess.Start(_startInfo);
  20. _process.Exited += Process_Exited;
  21. WaitHandle.WaitAll(new[] { _waitHandle });
複製代碼
個installer 是winamp
佢行行下settings會crash (winamp crash)
已set UAC為最低
and start as administrator
both the program and the installer. Why?

https://github.com/connor557/appstract

點解要用C# run?

TOP

因為我上網只找到這個project是open source..

TOP

因為我上網只找到這個project是open source..
luckiejacky 發表於 2016-12-17 19:49

如果你想就咁run一個execute...
System.Diagnostics.Process.Start(@"path");
就已經得.. 例如
System.Diagnostics.Process.Start(@"C:\Windows\system32\cmd.exe");

TOP

其實佢中間會做D process injection
here is a log
  1. 2016-12-17 18:35:07.732939 [Information] [Guest 4208] [Initializer] Successfully initialized core components.
  2. 2016-12-17 18:35:07.791943 [Information] [Main] A virtualized process with PID 4208 has been succesfully created for C:\Users\Jacky\Desktop\winamp280_full.exe.
  3. 2016-12-17 18:35:09.500040 [Debug] [Guest 4208] [Initializer] Invoking API hook installation procedure.
  4. 2016-12-17 18:35:09.507041 [Information] [Guest 4208] [Initializer] Creating system folders for a virtual environment with root "c:\users\jacky\desktop\test"
  5. 2016-12-17 18:35:09.528042 [Debug] [Guest 4208] [Initializer] Installed API hook: [kernel32.dll | CreateDirectoryW] Create Directory [Unicode]
  6. 2016-12-17 18:35:09.528042 [Debug] [Guest 4208] [Initializer] Installed API hook: [kernel32.dll | CreateDirectoryA] Create Directory [Ansi]
  7. 2016-12-17 18:35:09.528042 [Debug] [Guest 4208] [Initializer] Installed API hook: [kernel32.dll | CreateFileW] Create File [Unicode]
  8. 2016-12-17 18:35:09.531042 [Debug] [Guest 4208] [Initializer] Installed API hook: [kernel32.dll | CreateFileA] Create File [Ansi]
  9. 2016-12-17 18:35:09.532042 [Debug] [Guest 4208] [Initializer] Installed API hook: [kernel32.dll | DeleteFileW] Delete File [Unicode]
  10. 2016-12-17 18:35:09.532042 [Debug] [Guest 4208] [Initializer] Installed API hook: [kernel32.dll | DeleteFileA] Delete File [Ansi]
  11. 2016-12-17 18:35:09.532042 [Debug] [Guest 4208] [Initializer] Installed API hook: [kernel32.dll | RemoveDirectoryW] Remove Directory [Unicode]
  12. 2016-12-17 18:35:09.533042 [Debug] [Guest 4208] [Initializer] Installed API hook: [kernel32.dll | RemoveDirectoryA] Remove Directory [Ansi]
  13. 2016-12-17 18:35:09.533042 [Debug] [Guest 4208] [Initializer] Installed API hook: [kernel32.dll | LoadLibraryExW] Load Library [Unicode]
  14. 2016-12-17 18:35:09.538043 [Debug] [Guest 4208] [Initializer] Installed API hook: [kernel32.dll | LoadLibraryExA] Load Library [Ansi]
  15. 2016-12-17 18:35:09.540043 [Debug] [Guest 4208] [Initializer] Installed API hook: [kernel32.dll | GetTempPathA] Get Temp Path [Ansi]
  16. 2016-12-17 18:35:09.587045 [Debug] [Guest 4208] [Initializer] Installed API hook: [advapi32.dll | RegOpenKeyExW] Open Registry Key [Unicode]
  17. 2016-12-17 18:35:09.616047 [Debug] [Guest 4208] [Initializer] Installed API hook: [advapi32.dll | RegOpenKeyExA] Open Registry Key [Ansi]
  18. 2016-12-17 18:35:09.617047 [Debug] [Guest 4208] [Initializer] Installed API hook: [advapi32.dll | RegCreateKeyExW] Create Registry Key [Unicode]
  19. 2016-12-17 18:35:09.618047 [Debug] [Guest 4208] [Initializer] Installed API hook: [advapi32.dll | RegCreateKey'AppStract.Manager.vshost.exe' (CLR v2.0.50727: AppStract.Manager.vshost.exe): Loaded 'C:\Windows\assembly\GAC_MSIL\System.Data.SqlServerCe\3.5.1.0__89845dcd8080cc91\System.Data.SqlServerCe.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
  20. 'AppStract.Manager.vshost.exe' (CLR v2.0.50727: AppStract.Manager.vshost.exe): Loaded 'C:\Windows\assembly\GAC_32\System.Data\2.0.0.0__b77a5c561934e089\System.Data.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
  21. ExA] Create Registry Key [Ansi]
  22. 2016-12-17 18:35:09.539043 [Debug] [Guest 4208] [Initializer] Installed API hook: [kernel32.dll | GetTempPathW] Get Temp Path [Unicode]
  23. 2016-12-17 18:35:09.620047 [Debug] [Guest 4208] [Initializer] Installed API hook: [advapi32.dll | RegSetValueExW] Set Registry Value [Unicode]
  24. 2016-12-17 18:35:09.623047 [Debug] [Guest 4208] [Initializer] Installed API hook: [advapi32.dll | RegSetValueExA] Set Registry Value [Ansi]
  25. 2016-12-17 18:35:09.624048 [Debug] [Guest 4208] [Initializer] Installed API hook: [advapi32.dll | RegQueryValueExW] Query Registry Value [Unicode]
  26. 2016-12-17 18:35:09.625048 [Debug] [Guest 4208] [Initializer] Installed API hook: [advapi32.dll | RegQueryValueExA] Query Registry Value [Ansi]
  27. 2016-12-17 18:35:09.625048 [Debug] [Guest 4208] [Initializer] Finished API hook installation.
  28. 2016-12-17 18:35:09.625048 [Information] [Guest 4208] [Initializer] Virtualization Engine is started and running.
  29. 2016-12-17 18:35:09.660050 [Debug] [Guest 4208] [8] FileSystem Redirection: "C:\Users\Jacky\Desktop\winamp280_full.exe" => "C:\Users\Jacky\Desktop\winamp280_full.exe"
  30. 2016-12-17 18:35:09.618047 [Debug] [Guest 4208] [Initializer] Installed API hook: [advapi32.dll | RegCloseKey] Close Registry Key
  31. 2016-12-17 18:35:09.805058 [Debug] [Guest 4208] [8] QueryValue(HKey=21 ValueName=UninstallString) => Success
  32. 2016-12-17 18:35:09.813058 [Debug] [Guest 4208] [8] CloseKey(HKey=21) => Success
  33. 2016-12-17 18:35:09.820059 [Debug] [Guest 4208] [8] FileSystem Redirection: "UxTheme.dll" => "UxTheme.dll"
  34. 2016-12-17 18:35:09.822059 [Debug] [Guest 4208] [8] OpenKey(2147483650\\SOFTWARE\Microsoft\Windows NT\CurrentVersion\LanguagePack\SurrogateFallback) => 22
  35. 2016-12-17 18:35:09.824059 [Debug] [Guest 4208] [8] OpenKey(22\\MS Sans Serif) => FileNotFound
  36. 2016-12-17 18:35:09.825059 [Debug] [Guest 4208] [8] CloseKey(HKey=22) => Success
  37. 2016-12-17 18:35:09.852061 [Debug] [Guest 4208] [8] FileSystem Redirection: "C:\Windows\Registration\R00000000000c.clb" => "C:\Windows\Registration\R00000000000c.clb"
  38. 2016-12-17 18:35:09.754055 [Debug] [Guest 4208] [8] OpenKey(2147483650\\Software\Microsoft\Windows\CurrentVersion\Uninstall\Winamp) => 21
  39. 2016-12-17 18:35:10.061073 [Error] [Guest 4208] [9] [Database] Failed to flush
  40. Exception: AppStract.Utilities.Data.DatabaseException
  41.   Message: Failed to flush the database.
  42.   Source : AppStract.Utilities.Data.Sql.SqlDatabase`1.Write(IEnumerator`1 items)

  43. 2016-12-17 18:35:09.994069 [Error] [Guest 4208] [7] [Database] Failed to flush
  44. Exception: AppStract.Utilities.Data.DatabaseException
  45.   Message: Failed to flush the database.
  46.   Source : AppStract.Utilities.Data.Sql.SqlDatabase`1.Write(IEnumerator`1 items)

  47. 2016-12-17 18:35:10.168079 [Error] [Guest 4208] [7] [Database] Failed to flush
  48. Exception: AppStract.Utilities.Data.DatabaseException
  49.   Message: Failed to flush the database.
  50.   Source : AppStract.Utilities.Data.Sql.SqlDatabase`1.Write(IEnumerator`1 items)
複製代碼

TOP

你到底係要"Run一個installer"定係要做"application virtualization"......

TOP

如果你只係要"Run一個Installer" 我真係看不到問題所在...
附件: 您需要登錄才可以下載或查看附件。沒有帳號?註冊

TOP

Title 已改..

TOP

本帖最後由 7h1r733n 於 2016-12-18 02:48 編輯
Title 已改..
luckiejacky 發表於 2016-12-17 20:29

Application Virtualization本來就好難做得"好", 好多年前VMware有隻叫ThinApp其實都係一般般.. 你post果個project已經N年冇update.. 我得VS2015 compile有D問題.. 又冇舊版VS o系度... 你試跟跟住D error去fix睇吓得唔得...

Disable "Just My Code", 睇吓external code有冇其他error..  見招拆招.. 搞左一輪冇error可能都未必"work", 因為呢樣野本來就唔容易...

TOP

相關文章