Skip to content

Commit

Permalink
something
Browse files Browse the repository at this point in the history
  • Loading branch information
otya128 committed Jul 27, 2017
1 parent 1edd090 commit d56fe93
Show file tree
Hide file tree
Showing 25 changed files with 1,621 additions and 48 deletions.
10 changes: 6 additions & 4 deletions krnl386/dosexe.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,10 @@ static void MZ_CreatePSP( LPVOID lpPSP, WORD env, WORD par )
/* FIXME: more PSP stuff */
}

extern char *DOSMEM_dosmem;
static void MZ_FillPSP( LPVOID lpPSP, LPCSTR cmdtail, int length )
{
PDB16 *psp = lpPSP;
PDB16 *psp = (PDB16*)((size_t)lpPSP + DOSMEM_dosmem);

if(length > 127)
{
Expand Down Expand Up @@ -199,9 +200,10 @@ static BOOL MZ_InitMemory(void)
{
/* initialize the memory */
TRACE("Initializing DOS memory structures\n");
DOSMEM_MapDosLayout();
DOSDEV_InstallDOSDevices();
MSCDEX_InstallCDROM();
ERR("MZ_InitMemory()\n");
//DOSMEM_MapDosLayout();
//DOSDEV_InstallDOSDevices();
//MSCDEX_InstallCDROM();

return TRUE;
}
Expand Down
2 changes: 1 addition & 1 deletion krnl386/dosmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ static MCB* DOSMEM_root_block;
*/

/* DOS memory base (linear in process address space) */
static char *DOSMEM_dosmem;
/*static*/ char *DOSMEM_dosmem;
static char *DOSMEM_sysmem;
/* number of bytes protected from _dosmem. 0 when DOS memory is initialized,
* 64k otherwise to trap NULL pointers deref */
Expand Down
6 changes: 4 additions & 2 deletions krnl386/dosvm.c
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,8 @@ void DOSVM_QueueEvent( INT irq, INT priority, DOSRELAY relay, LPVOID data)
TRACE("new event queued, signalling (time=%d)\n", GetTickCount());

/* Alert VM86 thread about the new event. */
kill(dosvm_pid,SIGUSR2);
ERR("kill(%d, %d)\n", dosvm_pid, 12);
//kill(dosvm_pid,SIGUSR2);

/* Wake up DOSVM_Wait so that it can serve pending events. */
SetEvent(event_notifier);
Expand Down Expand Up @@ -496,7 +497,8 @@ DWORD DOSVM_Loop( HANDLE hThread )
DWORD waitret;

objs[count++] = hThread;
if (GetConsoleMode( GetStdHandle(STD_INPUT_HANDLE), NULL ))
DWORD ununsed;
if (GetConsoleMode( GetStdHandle(STD_INPUT_HANDLE), &ununsed))
objs[count++] = GetStdHandle(STD_INPUT_HANDLE);

for(;;) {
Expand Down
28 changes: 21 additions & 7 deletions krnl386/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -257,19 +257,24 @@ static char *get_search_path(void)
if (!(p = strrchr( module, '\\' ))) p = module;
*p = 0;
}
char windir[MAX_PATH];
char windir2[MAX_PATH];
char *windir3;
GetWindowsDirectoryA(windir, MAX_PATH);
windir3 = RedirectSystemDir(windir, windir2, MAX_PATH);

len = (2 + /* search order: first current dir */
GetSystemDirectory16( NULL, 0 ) + 1 + /* then system dir */
GetWindowsDirectoryA( NULL, 0 ) + 1 + /* then windows dir */
strlen(windir3) + 1 + /* then windows dir */
strlen( module ) + 1 + /* then module path */
GetEnvironmentVariableA( "PATH", NULL, 0 ) + 1); /* then look in PATH */
GetEnvironmentVariableA( "PATH16", NULL, 0 ) + 1); /* then look in PATH */
if (!(ret = HeapAlloc( GetProcessHeap(), 0, len ))) return NULL;
strcpy( ret, ".;" );
p = ret + 2;
GetSystemDirectory16( p, ret + len - p );
p += strlen( p );
*p++ = ';';
GetWindowsDirectoryA( p, ret + len - p );
strcpy(p, windir3);//GetWindowsDirectoryA( p, ret + len - p );
p += strlen( p );
*p++ = ';';
if (module[0])
Expand All @@ -278,7 +283,7 @@ static char *get_search_path(void)
p += strlen( p );
*p++ = ';';
}
GetEnvironmentVariableA( "PATH", p, ret + len - p );
GetEnvironmentVariableA( "PATH16", p, ret + len - p );
return ret;
}

Expand Down Expand Up @@ -324,6 +329,8 @@ HFILE16 WINAPI OpenFile16( LPCSTR name, OFSTRUCT *ofs, UINT16 mode )
return 0;
}

CHAR buf[OFS_MAXPATHNAME];
name = RedirectSystemDir(name, buf, OFS_MAXPATHNAME);
if (mode & OF_CREATE)
{
handle = (HANDLE)OpenFile( name, ofs, mode );
Expand Down Expand Up @@ -533,10 +540,10 @@ LONG WINAPI _hwrite16( HFILE16 hFile, LPCSTR buffer, LONG count )
*/
UINT WINAPI GetTempDrive( BYTE ignored )
{
WCHAR buffer[8];
WCHAR buffer[MAX_PATH];
BYTE ret;

if (GetTempPathW( 8, buffer )) ret = (BYTE)toupperW(buffer[0]);
if (GetTempPathW(MAX_PATH, buffer )) ret = (BYTE)toupperW(buffer[0]);
else ret = 'C';
return MAKELONG( ret | (':' << 8), 1 );
}
Expand Down Expand Up @@ -610,6 +617,7 @@ const char *GetRedirectWindowsDir()
GetModuleFileNameA(GetModuleHandleA("krnl386.exe16"), windowsPath, MAX_PATH);
PathRemoveFileSpecA(windowsPath);
PathCombineA(windowsPath, windowsPath, "WINDOWS");
GetShortPathNameA(windowsPath, windowsPath, sizeof(windowsPath));
return windowsPath;
}

Expand Down Expand Up @@ -728,7 +736,13 @@ BOOL16 WINAPI WritePrivateProfileString16( LPCSTR section, LPCSTR entry,
*/
UINT16 WINAPI GetWindowsDirectory16( LPSTR path, UINT16 count )
{
return GetWindowsDirectoryA( path, count );
const char *w = GetRedirectWindowsDir();
UINT16 len = strlen(w);
if (len + 1 > count)
return strlen(w) + 1;
strcpy(path, w);
return len;
//return GetWindowsDirectoryA( path, count );
}


Expand Down
2 changes: 1 addition & 1 deletion krnl386/krnl386.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>ENABLEREDIRECTSYSTEMDIR;WIN32;_DEBUG;_WINDOWS;_USRDLL;KRNL386_EXPORTS;_X86_;__WINESRC__;__i386__;USE_COMPILER_EXCEPTIONS;HAVE_STRNCASECMP;HAVE__STRNICMP;_WINTERNL_;NtCurrentTeb=NtCurrentTeb__;inline=__inline</PreprocessorDefinitions>
<PreprocessorDefinitions>MZ_SUPPORTED;ENABLEREDIRECTSYSTEMDIR;WIN32;_DEBUG;_WINDOWS;_USRDLL;KRNL386_EXPORTS;_X86_;__WINESRC__;__i386__;USE_COMPILER_EXCEPTIONS;HAVE_STRNCASECMP;HAVE__STRNICMP;_WINTERNL_;NtCurrentTeb=NtCurrentTeb__;inline=__inline</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
Expand Down
1 change: 1 addition & 0 deletions krnl386/stub.c
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ DWORD CALL32_CBClientEx(FARPROC proc, LPWORD args, WORD *stackLin, DWORD *esi, I
}
void __wine_enter_vm86(CONTEXT *context)
{
wine_call_to_16_regs_vm86(context, NULL, NULL, __wine_call_from_16_regs, __wine_call_from_16, relay_call_from_16, __wine_call_to_16_ret, TRACE_ON(disasm));
DPRINTF("NOTIMPL:__wine_enter_vm86(%p)\n", context);
}
void __wine_spec_init_ctor()
Expand Down
16 changes: 12 additions & 4 deletions krnl386/thunk.c
Original file line number Diff line number Diff line change
Expand Up @@ -2401,14 +2401,22 @@ DWORD WINAPI LoadLibraryEx32W16( LPCSTR lpszLibFile, DWORD hFile, DWORD dwFlags
{
if (OpenFile16( lpszLibFile, &ofs, OF_EXIST ) != HFILE_ERROR16)
lpszLibFile = ofs.szPathName;
else
{
return 0;
}
}
else
{
char buffer[MAX_PATH+4];
strcpy( buffer, lpszLibFile );
strcat( buffer, ".dll" );
if (OpenFile16( buffer, &ofs, OF_EXIST ) != HFILE_ERROR16)
char buffer[MAX_PATH + 4];
strcpy(buffer, lpszLibFile);
strcat(buffer, ".dll");
if (OpenFile16(buffer, &ofs, OF_EXIST) != HFILE_ERROR16)
lpszLibFile = ofs.szPathName;
else
{
return 0;
}
}

ReleaseThunkLock( &mutex_count );
Expand Down
1 change: 1 addition & 0 deletions olecli/stub.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ void __wine_spec_init_ctor()
void __wine_spec_unimplemented_stub(const char *module, const char *function)
{
DPRINTF("NOTIMPL:__wine_spec_unimplemented_stub(%s, %s)\n", module, function);
*(char*)NULL = 1;
}
void __wine_spec_dll_entry()
{
Expand Down
30 changes: 30 additions & 0 deletions otvdm.sln
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vdmwrapperexe", "vdmwrapper
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ddeml", "ddeml\ddeml.vcxproj", "{D4EED8A5-2B15-4299-9F65-D56383AC7848}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "toolhelp", "toolhelp\toolhelp.vcxproj", "{96925A3C-9DD9-418E-A772-A112FFE93DC2}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ver", "ver\ver.vcxproj", "{7C04956D-FEBE-410F-ABB1-945695CDDFE5}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Expand Down Expand Up @@ -497,6 +501,32 @@ Global
{D4EED8A5-2B15-4299-9F65-D56383AC7848}.Release|Win32.ActiveCfg = Release|Win32
{D4EED8A5-2B15-4299-9F65-D56383AC7848}.Release|Win32.Build.0 = Release|Win32
{D4EED8A5-2B15-4299-9F65-D56383AC7848}.Release|x64.ActiveCfg = Release|Win32
{96925A3C-9DD9-418E-A772-A112FFE93DC2}.Debug|Win32.ActiveCfg = Debug|Win32
{96925A3C-9DD9-418E-A772-A112FFE93DC2}.Debug|Win32.Build.0 = Debug|Win32
{96925A3C-9DD9-418E-A772-A112FFE93DC2}.Debug|x64.ActiveCfg = Debug|Win32
{96925A3C-9DD9-418E-A772-A112FFE93DC2}.Debug-USER.EXE|Win32.ActiveCfg = Debug|Win32
{96925A3C-9DD9-418E-A772-A112FFE93DC2}.Debug-USER.EXE|Win32.Build.0 = Debug|Win32
{96925A3C-9DD9-418E-A772-A112FFE93DC2}.Debug-USER.EXE|x64.ActiveCfg = Release|Win32
{96925A3C-9DD9-418E-A772-A112FFE93DC2}.Debug-USER.EXE|x64.Build.0 = Release|Win32
{96925A3C-9DD9-418E-A772-A112FFE93DC2}.GenLibFileRelease|Win32.ActiveCfg = GenLibFileRelease|Win32
{96925A3C-9DD9-418E-A772-A112FFE93DC2}.GenLibFileRelease|Win32.Build.0 = GenLibFileRelease|Win32
{96925A3C-9DD9-418E-A772-A112FFE93DC2}.GenLibFileRelease|x64.ActiveCfg = GenLibFileRelease|Win32
{96925A3C-9DD9-418E-A772-A112FFE93DC2}.Release|Win32.ActiveCfg = Release|Win32
{96925A3C-9DD9-418E-A772-A112FFE93DC2}.Release|Win32.Build.0 = Release|Win32
{96925A3C-9DD9-418E-A772-A112FFE93DC2}.Release|x64.ActiveCfg = Release|Win32
{7C04956D-FEBE-410F-ABB1-945695CDDFE5}.Debug|Win32.ActiveCfg = Debug|Win32
{7C04956D-FEBE-410F-ABB1-945695CDDFE5}.Debug|Win32.Build.0 = Debug|Win32
{7C04956D-FEBE-410F-ABB1-945695CDDFE5}.Debug|x64.ActiveCfg = Debug|Win32
{7C04956D-FEBE-410F-ABB1-945695CDDFE5}.Debug-USER.EXE|Win32.ActiveCfg = Debug|Win32
{7C04956D-FEBE-410F-ABB1-945695CDDFE5}.Debug-USER.EXE|Win32.Build.0 = Debug|Win32
{7C04956D-FEBE-410F-ABB1-945695CDDFE5}.Debug-USER.EXE|x64.ActiveCfg = Release|Win32
{7C04956D-FEBE-410F-ABB1-945695CDDFE5}.Debug-USER.EXE|x64.Build.0 = Release|Win32
{7C04956D-FEBE-410F-ABB1-945695CDDFE5}.GenLibFileRelease|Win32.ActiveCfg = GenLibFileRelease|Win32
{7C04956D-FEBE-410F-ABB1-945695CDDFE5}.GenLibFileRelease|Win32.Build.0 = GenLibFileRelease|Win32
{7C04956D-FEBE-410F-ABB1-945695CDDFE5}.GenLibFileRelease|x64.ActiveCfg = GenLibFileRelease|Win32
{7C04956D-FEBE-410F-ABB1-945695CDDFE5}.Release|Win32.ActiveCfg = Release|Win32
{7C04956D-FEBE-410F-ABB1-945695CDDFE5}.Release|Win32.Build.0 = Release|Win32
{7C04956D-FEBE-410F-ABB1-945695CDDFE5}.Release|x64.ActiveCfg = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
2 changes: 2 additions & 0 deletions otvdm/winevdm.c
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,8 @@ int main( int argc, char *argv[] )
/* loader expects arguments to be regular C strings */
start_dos_exe( appname, cmdline + 1 );
}
#else
__wine_load_dos_exe(appname, cmdline + 1);
#endif
/* if we get back here it failed */
instance = GetLastError();
Expand Down
29 changes: 22 additions & 7 deletions user/dialog.c
Original file line number Diff line number Diff line change
Expand Up @@ -504,13 +504,28 @@ static BOOL DIALOG_CreateControls16Ex(HWND hwnd, LPCSTR template,
dlgItemTemplate32->id = info.id;
dlgItemTemplatew = (WORD*)(dlgItemTemplate32 + 1);
copy_widestr(info.className, &dlgItemTemplatew);
if (!HIWORD(info.windowName))
{
char buffer[512];
if(LoadString16(hInst, LOWORD(info.windowName), buffer, sizeof(buffer)))
info.windowName = buffer;
}
copy_widestr(info.windowName, &dlgItemTemplatew);
if (!HIWORD(info.windowName))
{
char buffer[512];
if (((dlgItemTemplate32->style & 0xF) == SS_ICON || (dlgItemTemplate32->style & 0xF) == SS_BITMAP) && stricmp(info.className, "STATIC") == 0)
{
sprintf(buffer, "#%d", (int)info.windowName);
copy_widestr(buffer, &dlgItemTemplatew);
//LoadImage16
}
else
{
if (LoadString16(hInst, LOWORD(info.windowName), buffer, sizeof(buffer)))
info.windowName = buffer;
else
info.windowName = "dialog error: invalid window name";
copy_widestr(info.windowName, &dlgItemTemplatew);
}
}
else
{
copy_widestr(info.windowName, &dlgItemTemplatew);
}
if (info.data)
{
*dlgItemTemplatew++ = sizeof(WORD) + sizeof(info.data);
Expand Down
24 changes: 13 additions & 11 deletions user/message.c
Original file line number Diff line number Diff line change
Expand Up @@ -1844,7 +1844,8 @@ LRESULT WINAPI SendMessage16( HWND16 hwnd16, UINT16 msg, WPARAM16 wparam, LPARAM
}
else /* map to 32-bit unicode for inter-thread/process message */
{
WINPROC_CallProc16To32A( send_message_callback, hwnd16, msg, wparam, lparam, &result, NULL );
ERR("SendMessage(HWND_BROADCAST,)\n");
WINPROC_CallProc16To32A( post_message_callback, hwnd16, msg, wparam, lparam, &result, NULL );
}
return result;
}
Expand Down Expand Up @@ -2943,49 +2944,50 @@ static LRESULT scrollbar_proc16( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar
return wow_handlers32.scrollbar_proc( hwnd, msg, wParam, lParam, FALSE );
}


/***********************************************************************
* static_proc16
*/
static LRESULT static_proc16( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, BOOL unicode )
{
switch (msg)
{
case WM_NCCREATE:
case WM_CREATE://WM_NCCREATE:
{
CREATESTRUCTA *cs = (CREATESTRUCTA *)lParam;
LRESULT ret = wow_handlers32.static_proc( hwnd, msg, wParam, lParam, unicode );

if (!ret) return 0;
if (((ULONG_PTR)cs->hInstance >> 16)) return ret; /* 32-bit instance, nothing to do */
if (((ULONG_PTR)cs->hInstance >> 16)) break; /* 32-bit instance, nothing to do */
switch (cs->style & SS_TYPEMASK)
{
case SS_ICON:
{
LRESULT ret = wow_handlers32.static_proc(hwnd, msg, wParam, lParam, unicode);
SetWindowTextA(hwnd, "");
HICON16 icon = LoadIcon16( HINSTANCE_16(cs->hInstance), cs->lpszName );
if (!icon) icon = LoadCursor16( HINSTANCE_16(cs->hInstance), cs->lpszName );
if (icon) wow_handlers32.static_proc( hwnd, STM_SETIMAGE, IMAGE_ICON,
(LPARAM)get_icon_32(icon), FALSE );
break;
return ret;
}
case SS_BITMAP:
{
LRESULT ret = wow_handlers32.static_proc(hwnd, msg, wParam, lParam, unicode);
SetWindowTextA(hwnd, "");
HBITMAP16 bitmap = LoadBitmap16( HINSTANCE_16(cs->hInstance), cs->lpszName );
if (bitmap) wow_handlers32.static_proc( hwnd, STM_SETIMAGE, IMAGE_BITMAP,
(LPARAM)HBITMAP_32(bitmap), FALSE );
break;
return ret;
}
}
return ret;
break;
}
case STM_SETICON16:
wParam = (WPARAM)get_icon_32( (HICON16)wParam );
return wow_handlers32.static_proc( hwnd, STM_SETICON, wParam, lParam, FALSE );
case STM_GETICON16:
return get_icon_16( (HICON)wow_handlers32.static_proc( hwnd, STM_GETICON, wParam, lParam, FALSE ));
default:
return wow_handlers32.static_proc( hwnd, msg, wParam, lParam, unicode );
break;
}
return wow_handlers32.static_proc(hwnd, msg, wParam, lParam, unicode);
}
LRESULT CALLBACK static_wndproc16(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
Expand Down
4 changes: 2 additions & 2 deletions user/user.exe16.asm
Original file line number Diff line number Diff line change
Expand Up @@ -4145,7 +4145,7 @@ _wine_spec_dos_header:
callw .L__wine_spec_callfrom16_p_long_wwwl
.L__wine_USER_112:
pushw %bp
pushl $_WaitMessage@0
pushl $_WaitMessage16@0
callw .L__wine_spec_callfrom16_p_word_
.L__wine_USER_113:
pushw %bp
Expand Down Expand Up @@ -4669,7 +4669,7 @@ _wine_spec_dos_header:
callw .L__wine_spec_callfrom16_p_word_wpwll
.L__wine_USER_243:
pushw %bp
pushl $_GetDialogBaseUnits@0
pushl $_GetDialogBaseUnits16@0
callw .L__wine_spec_callfrom16_p_long_
.L__wine_USER_244:
pushw %bp
Expand Down
2 changes: 1 addition & 1 deletion user/user.exe16.spec
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@
240 pascal -ret16 DialogBoxIndirectParam(word word word segptr long) DialogBoxIndirectParam16
241 pascal -ret16 CreateDialogParam(word str word segptr long) CreateDialogParam16
242 pascal -ret16 CreateDialogIndirectParam(word ptr word segptr long) CreateDialogIndirectParam16
243 pascal GetDialogBaseUnits() GetDialogBaseUnits
243 pascal GetDialogBaseUnits() GetDialogBaseUnits16
244 pascal -ret16 EqualRect(ptr ptr) EqualRect16
245 pascal -ret16 EnableCommNotification(s_word word s_word s_word) EnableCommNotification16
246 pascal -ret16 ExitWindowsExec(str str) ExitWindowsExec16
Expand Down
6 changes: 6 additions & 0 deletions ver/Makefile.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
MODULE = ver.dll16
IMPORTS = version lz32

EXTRADLLFLAGS = -m16 -Wb,--main-module,version.dll

C_SRCS = version.c
14 changes: 14 additions & 0 deletions ver/stub.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include "wine/debug.h"
//
void __wine_spec_init_ctor()
{
DPRINTF("NOTIMPL:__wine_spec_init_ctor()\n");
}
void __wine_spec_unimplemented_stub(const char *module, const char *function)
{
DPRINTF("NOTIMPL:__wine_spec_unimplemented_stub(%s, %s)\n", module, function);
}
void __wine_spec_dll_entry()
{
DPRINTF("NOTIMPL:__wine_spec_dll_entry(?)\n");
}
Loading

0 comments on commit d56fe93

Please sign in to comment.