Author: akhaldi Date: Wed Jan 13 16:23:21 2016 New Revision: 70590
URL: http://svn.reactos.org/svn/reactos?rev=70590&view=rev Log: [0.4.0] * Merge rosvboxmgmt work by Pierre in revisions 70536, 70537 and 70578. This reverts r70520 (shortcuts creation for VBox shared folders). CORE-10032 ROSAPPS-303
Modified: branches/ros-branch-0_4_0/ (props changed) branches/ros-branch-0_4_0/reactos/ (props changed) branches/ros-branch-0_4_0/reactos/boot/bootdata/hivesft.inf branches/ros-branch-0_4_0/rosapps/applications/cmdutils/rosvboxmgmt/rosvboxmgmt.c
Propchange: branches/ros-branch-0_4_0/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Wed Jan 13 16:23:21 2016 @@ -1 +1 @@ -/trunk:70000-70321,70323-70324,70328-70337,70339-70340,70347,70349,70354-70358,70360,70363,70369,70373,70375-70378,70381,70384-70385,70387-70389,70398,70400,70408,70424,70433-70437,70443,70445-70449,70454,70464,70468,70470,70480,70497,70499-70501,70507-70510,70512-70513,70523,70527-70530,70545-70548,70552-70554,70557-70558,70576,70583 +/trunk:70000-70321,70323-70324,70328-70337,70339-70340,70347,70349,70354-70358,70360,70363,70369,70373,70375-70378,70381,70384-70385,70387-70389,70398,70400,70408,70424,70433-70437,70443,70445-70449,70454,70464,70468,70470,70480,70497,70499-70501,70507-70510,70512-70513,70523,70527-70530,70536-70537,70545-70548,70552-70554,70557-70558,70576,70578,70583
Propchange: branches/ros-branch-0_4_0/reactos/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Wed Jan 13 16:23:21 2016 @@ -20,4 +20,4 @@ /branches/usb-bringup:51335,51337,51341-51343,51348,51350,51353,51355,51365-51369,51372,51384-54388,54396-54398,54736-54737,54752-54754,54756-54760,54762,54764-54765,54767-54768,54772,54774-54777,54781,54787,54790-54792,54797-54798,54806,54808,54834-54838,54843,54850,54852,54856,54858-54859 /branches/usb-bringup-trunk:55019-55543,55548-55554,55556-55567 /branches/wlan-bringup:54809-54998 -/trunk/reactos:70000-70321,70323-70324,70328-70337,70339-70340,70347,70349,70354-70358,70360,70363,70369,70373,70375-70378,70381,70384-70385,70387-70389,70398,70400,70408,70424,70433-70437,70443,70445-70449,70454,70464,70468,70470,70480,70497,70501,70507-70510,70523,70527-70530,70545-70548,70552-70554,70557-70558,70576,70583 +/trunk/reactos:70000-70321,70323-70324,70328-70337,70339-70340,70347,70349,70354-70358,70360,70363,70369,70373,70375-70378,70381,70384-70385,70387-70389,70398,70400,70408,70424,70433-70437,70443,70445-70449,70454,70464,70468,70470,70480,70497,70501,70507-70510,70523,70527-70530,70536-70537,70545-70548,70552-70554,70557-70558,70576,70578,70583
Modified: branches/ros-branch-0_4_0/reactos/boot/bootdata/hivesft.inf URL: http://svn.reactos.org/svn/reactos/branches/ros-branch-0_4_0/reactos/boot/bo... ============================================================================== --- branches/ros-branch-0_4_0/reactos/boot/bootdata/hivesft.inf [iso-8859-1] (original) +++ branches/ros-branch-0_4_0/reactos/boot/bootdata/hivesft.inf [iso-8859-1] Wed Jan 13 16:23:21 2016 @@ -142,7 +142,8 @@ HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce","InstallRoot.NET",0x00000000,"cmd /c reg add HKLM\SOFTWARE\Microsoft.NETFramework /v InstallRoot /t REG_SZ /d %SystemRoot%\Microsoft.NET\Framework"
; HACK - Start rosvboxmgmt - ROSAPPS-303 -HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\Run","Handle VBox SF",0x00000000,"%windir%\bin\rosvboxmgmt auto" +;HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\Run","Handle VBox SF",0x00000000,"%windir%\bin\rosvboxmgmt autolink" +;HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\Run","Handle VBox SF",0x00000000,"%windir%\bin\rosvboxmgmt autoassign"
HKCU,"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons",,0x00000012 HKCU,"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\ClassicStartMenu",,0x00000012
Modified: branches/ros-branch-0_4_0/rosapps/applications/cmdutils/rosvboxmgmt/rosvboxmgmt.c URL: http://svn.reactos.org/svn/reactos/branches/ros-branch-0_4_0/rosapps/applica... ============================================================================== --- branches/ros-branch-0_4_0/rosapps/applications/cmdutils/rosvboxmgmt/rosvboxmgmt.c [iso-8859-1] (original) +++ branches/ros-branch-0_4_0/rosapps/applications/cmdutils/rosvboxmgmt/rosvboxmgmt.c [iso-8859-1] Wed Jan 13 16:23:21 2016 @@ -177,7 +177,7 @@ return 0; }
-BOOL CreateUNCShortcut(PCWSTR share) +BOOL createUNCShortcut(PCWSTR share) { HRESULT res; IShellLink *link; @@ -219,12 +219,68 @@ return SUCCEEDED(res); }
-int autoStart(void) +BOOL assignDriveLetter(PCWSTR share) +{ + DWORD driveMap; + char drive; + wchar_t cmdLine[MAX_PATH]; + STARTUPINFOW startupInfo; + PROCESS_INFORMATION processInformation; + BOOL ok = FALSE; + + driveMap = GetLogicalDrives(); + + for (drive = _MRX_MAX_DRIVE_LETTERS - 1; drive >= 0; ++drive) + { + if (!(driveMap & (1 << drive))) + { + break; + } + } + + if (drive < 0) + { + wprintf(L"Failed finding an appropriate drive for shared folder\n"); + return 1; + } + + drive += 'A'; + + wsprintf(cmdLine, L"hackssign_client.exe assign %c %s", drive, share); + RtlZeroMemory(&startupInfo, sizeof(startupInfo)); + startupInfo.cb = sizeof(STARTUPINFOW); + + if (!CreateProcessW(NULL, + (PVOID)cmdLine, + NULL, + NULL, + FALSE, + 0, + NULL, + NULL, + &startupInfo, + &processInformation)) + { + wprintf(L"Failed starting hackssign_client.exe\n"); + return 1; + } + + ok = (WaitForSingleObject(processInformation.hProcess, -1) == WAIT_OBJECT_0); + CloseHandle(processInformation.hProcess); + CloseHandle(processInformation.hThread); + + wprintf(L"%c assigned to %s\n", drive, share); + + return ok; +} + +int autoStart(BOOL assign) { short i; BOOL ret; DWORD outputBufferSize; char outputBuffer[_MRX_MAX_DRIVE_LETTERS]; + OFSTRUCT ofs;
if (startVBoxSrv() != 0) { @@ -239,7 +295,28 @@ return 1; }
- CoInitialize(NULL); + if (assign) + { + wchar_t path[MAX_PATH]; + if (GetModuleFileName(NULL, path, ARRAYSIZE(path)) != 0) + { + *(wcsrchr(path, '\')) = 0; + wprintf(L"Switching to %s\n", path); + SetCurrentDirectory(path); + } + + if (OpenFile("hackssign_client.exe", &ofs, OF_EXIST) != 1) + { + wprintf(L"hackssign_client.exe not found, falling back to links\n"); + assign = FALSE; + } + } + + if (!assign) + { + CoInitialize(NULL); + } + for (i = 0; i < _MRX_MAX_DRIVE_LETTERS; ++i) { CHAR id = outputBuffer[i]; @@ -255,7 +332,14 @@ continue; }
- CreateUNCShortcut(name); + if (!assign) + { + createUNCShortcut(name); + } + else + { + assignDriveLetter(name); + } }
return 0; @@ -268,7 +352,8 @@ wprintf(L"\taddconn <letter> <share name>: add a connection\n"); wprintf(L"\tgetlist: list connections\n"); wprintf(L"\tgetgloballist: list available shares\n"); - wprintf(L"\tauto: automagically configure the VBox Shared folders and creates desktop folders\n"); + wprintf(L"\tautolink: automagically configure the VBox Shared folders and creates desktop folders\n"); + wprintf(L"\tautoassign: automagically configure the VBox Shared folders and assigns drive letters\n"); }
int wmain(int argc, wchar_t *argv[]) @@ -305,9 +390,13 @@ { return getGlobalList(); } - else if (_wcsicmp(cmd, L"auto") == 0) - { - return autoStart(); + else if (_wcsicmp(cmd, L"autolink") == 0) + { + return autoStart(FALSE); + } + else if (_wcsicmp(cmd, L"autoassign") == 0) + { + return autoStart(TRUE); } else {