summaryrefslogtreecommitdiffstats
path: root/remote/modules
diff options
context:
space:
mode:
authorSimon Rettberg2016-03-18 16:14:21 +0100
committerSimon Rettberg2016-03-18 16:14:21 +0100
commit1e200f282a019b725bc56f8eb0bc656f02a823e6 (patch)
treefc5f1122b76ab9296928b754cbeb1fa50f050617 /remote/modules
parent[run-virt/vmware] Error messages if mounting in win fails, fallback logic (diff)
downloadtm-scripts-1e200f282a019b725bc56f8eb0bc656f02a823e6.tar.gz
tm-scripts-1e200f282a019b725bc56f8eb0bc656f02a823e6.tar.xz
tm-scripts-1e200f282a019b725bc56f8eb0bc656f02a823e6.zip
[run-virt] Remove debug messages, pass home drive letter
Diffstat (limited to 'remote/modules')
-rw-r--r--remote/modules/run-virt/data/opt/openslx/scripts/includes/setup_virtual_floppy.inc1
-rwxr-xr-xremote/modules/run-virt/data/opt/openslx/vmchooser/data/openslx.exebin58368 -> 58368 bytes
-rw-r--r--remote/modules/run-virt/winres.c42
3 files changed, 27 insertions, 16 deletions
diff --git a/remote/modules/run-virt/data/opt/openslx/scripts/includes/setup_virtual_floppy.inc b/remote/modules/run-virt/data/opt/openslx/scripts/includes/setup_virtual_floppy.inc
index 48033d41..cb5b54b4 100644
--- a/remote/modules/run-virt/data/opt/openslx/scripts/includes/setup_virtual_floppy.inc
+++ b/remote/modules/run-virt/data/opt/openslx/scripts/includes/setup_virtual_floppy.inc
@@ -26,6 +26,7 @@ cat > "${TMPDIR}/geraffel.ini" <<-HIER
resolution=${RESOLUTION}
createMissingRemap=${SHARE_CREATE_MISSING_REMAP}
remapMode=${SHARE_REMAP_MODE}
+homeDrive=${SHARE_HOME_DRIVE}
[remap]
documents=${SHARE_DOCUMENTS}
diff --git a/remote/modules/run-virt/data/opt/openslx/vmchooser/data/openslx.exe b/remote/modules/run-virt/data/opt/openslx/vmchooser/data/openslx.exe
index 0123d474..4a2c62af 100755
--- a/remote/modules/run-virt/data/opt/openslx/vmchooser/data/openslx.exe
+++ b/remote/modules/run-virt/data/opt/openslx/vmchooser/data/openslx.exe
Binary files differ
diff --git a/remote/modules/run-virt/winres.c b/remote/modules/run-virt/winres.c
index 0ac24105..bc4f427d 100644
--- a/remote/modules/run-virt/winres.c
+++ b/remote/modules/run-virt/winres.c
@@ -29,11 +29,11 @@ DEFINE_GUID(ID_MMDeviceEnumerator, 0xBCDE0395, 0xE52F, 0x467C, 0x8E, 0x3D, 0xC4,
#define WM_SOCKDATA (WM_APP+1)
typedef struct {
- char* path;
- char* letter;
- char* shortcut;
- char* user;
- char* pass;
+ const char* path;
+ const char* letter;
+ const char* shortcut;
+ const char* user;
+ const char* pass;
BOOL success;
} netdrive_t;
@@ -57,6 +57,7 @@ static int _folderStatus = FS_UNKNOWN; // -1 = Not handled yet, 0 = patching fai
#define RM_NATIVE_FALLBACK (2)
#define RM_VMWARE (3)
static int _remapMode = RM_NONE;
+static const char* _remapHomeDrive = NULL;
struct {
BOOL documents;
@@ -230,6 +231,12 @@ static void loadPaths()
if (_remapMode == RM_NONE) {
_folderStatus = FS_OK;
}
+ char buffer[10];
+ GetPrivateProfileStringA("openslx", "homeDrive", "H:", buffer, sizeof(buffer), SETTINGS_FILE);
+ buffer[0] = toupper(buffer[0]);
+ buffer[1] = ':';
+ buffer[2] = '\0';
+ _remapHomeDrive = strdup(buffer);
}
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
@@ -472,7 +479,7 @@ static char* getToken(char **ptr, BOOL doDup)
return dest;
}
-#define FREENULL(x) do { free(x); (x) = NULL; } while (0)
+#define FREENULL(x) do { free((void*)(x)); (x) = NULL; } while (0)
static void readShareFile()
{
@@ -624,8 +631,12 @@ static DWORD mount(LPNETRESOURCEW share, LPWSTR pass, LPWSTR user)
static wchar_t nuser[BUFLEN] = L"", npass[BUFLEN] = L"";
if (nuser[0] == 0 && npass[0] == 0) {
BOOL ok = TRUE;
- ok = MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)suser, -1, (LPWSTR)nuser, BUFLEN) > 0 && ok;
- ok = MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)spass, -1, (LPWSTR)npass, BUFLEN) > 0 && ok;
+ if (suser != NULL) {
+ ok = MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)suser, -1, (LPWSTR)nuser, BUFLEN) > 0 && ok;
+ }
+ if (spass != NULL) {
+ ok = MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)spass, -1, (LPWSTR)npass, BUFLEN) > 0 && ok;
+ }
if (!ok)
return ERROR_INVALID_PARAMETER;
}
@@ -649,7 +660,6 @@ static void postSuccessfulMount(const netdrive_t *d, wchar_t *letter)
if (_remapMode == RM_NATIVE_FALLBACK
|| (isVmware && _remapMode == RM_VMWARE)
|| (!isVmware && _remapMode == RM_NATIVE)) {
- alog("Patch user paths (%d)", (int)isVmware);
patchUserPaths(letter);
}
}
@@ -753,22 +763,22 @@ static void remapViaSharedFolder()
if (once) return;
once = TRUE;
netdrive_t d;
- d.path = (char*)homeDirA;
- d.letter = (char*)"H:";
- d.shortcut = (char*)"Home-Verzeichnis";
- d.user = NULL;
- d.pass = NULL;
+ d.path = homeDirA;
+ d.letter = _remapHomeDrive;
+ d.shortcut = "Home-Verzeichnis";
+ d.user = "";
+ d.pass = "";
d.success = FALSE;
// See if it's already mapped
wchar_t letter[5] = L"C:\\";
char buffer[600];
UNIVERSAL_NAME_INFOW *uni = (UNIVERSAL_NAME_INFOW*)buffer;
for (letter[0] = 'D'; letter[0] <= 'Z'; ++letter[0]) {
- wlog(L"Checking %s", letter);
+ //wlog(L"Checking %s", letter);
DWORD len = (DWORD)sizeof(buffer);
if (NO_ERROR == WNetGetUniversalNameW(letter, UNIVERSAL_NAME_INFO_LEVEL, uni, &len)) {
_wcslwr(uni->lpUniversalName);
- wlog(L"Is %s", uni->lpUniversalName);
+ //wlog(L"Is %s", uni->lpUniversalName);
if (wcscmp(uni->lpUniversalName, homeDirW) == 0) {
letter[2] = '\0';
postSuccessfulMount(&d, letter);