Skip to content

Commit 8270181

Browse files
committed
Add dll directory
1 parent 3becdf4 commit 8270181

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

otvdm.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
;WINVER=3.1
1515

16-
; Separate taskbar icons among programs. (default: 1)
16+
; Separate taskbar icons among programs. (default: 2)
1717
; 0: Don't separate
1818
; 1: Separate for each otvdm.exe process
1919
; 2: Separate

otvdm/winevdm.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -775,6 +775,19 @@ typedef enum _APPCOMPAT_USERFLAGS_HIGHPART
775775
} APPCOMPAT_USERFLAGS_HIGHPART;
776776
//===reactos/sdk/include/ndk/pstypes.h==
777777

778+
void set_dll_path()
779+
{
780+
WCHAR mod_path[MAX_PATH];
781+
GetModuleFileNameW(NULL, mod_path, _countof(mod_path));
782+
LPWSTR last = wcsrchr(mod_path, L'\\');
783+
last[0] = 0;
784+
LPCWSTR dir = L"\\dll";
785+
if (wcslen(last) + wcslen(dir) + 1 >= MAX_PATH)
786+
return;
787+
memcpy(last, dir, (wcslen(dir) + 1) * sizeof(*dir));
788+
SetDllDirectoryW(mod_path);
789+
}
790+
778791
static BOOL set_peb_compatible_flag()
779792
{
780793
BOOL success = TRUE;
@@ -784,6 +797,7 @@ static BOOL set_peb_compatible_flag()
784797
APPCOMPAT_USERFLAGS_HIGHPART flags3 = (APPCOMPAT_USERFLAGS_HIGHPART)teb->Peb->AppCompatFlagsUser.HighPart;
785798
APPCOMPAT_FLAGS f = NoPaddedBorder | NoGhost;
786799
HMODULE user32 = GetModuleHandleA("user32.dll");
800+
set_dll_path();
787801
if ((flags2 & f) != f && user32 != NULL)
788802
{
789803
WINE_ERR("user32.dll has already been loaded. (Anti-virus software may be the cause.)\n");
@@ -1121,7 +1135,6 @@ int main( int argc, char *argv[] )
11211135

11221136
RestoreThunkLock(1); /* grab the Win16 lock */
11231137

1124-
SetDllDirectoryA(argv[0]);
11251138
/* some programs assume mmsystem is always present */
11261139
LoadLibrary16( "gdi.exe" );
11271140
LoadLibrary16( "user.exe" );

0 commit comments

Comments
 (0)