mirror of
https://github.com/reactos/reactos.git
synced 2024-08-19 18:02:55 +00:00
Added support for lauching VDM on dos image load.
Depends phase in makefile for processing with wmc. Included message table resources section. Added some some missing exports for wine module linkage. svn path=/trunk/; revision=3948
This commit is contained in:
parent
3f13766f16
commit
0ffa768455
|
@ -263,6 +263,8 @@ GetExitCodeThread@8
|
||||||
GetFiberData@0
|
GetFiberData@0
|
||||||
GetFileAttributesA@4
|
GetFileAttributesA@4
|
||||||
GetFileAttributesW@4
|
GetFileAttributesW@4
|
||||||
|
GetFileAttributesExA
|
||||||
|
GetFileAttributesExW
|
||||||
GetFileInformationByHandle@8
|
GetFileInformationByHandle@8
|
||||||
GetFileSize@8
|
GetFileSize@8
|
||||||
GetFileTime@16
|
GetFileTime@16
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
; $Id: kernel32.edf,v 1.19 2003/01/05 14:32:32 robd Exp $
|
; $Id: kernel32.edf,v 1.20 2003/01/07 17:29:09 robd Exp $
|
||||||
;
|
;
|
||||||
; kernel32.edf
|
; kernel32.edf
|
||||||
;
|
;
|
||||||
|
@ -54,6 +54,7 @@ BuildCommDCBAndTimeoutsW=BuildCommDCBAndTimeoutsW@12
|
||||||
BuildCommDCBW=BuildCommDCBW@8
|
BuildCommDCBW=BuildCommDCBW@8
|
||||||
CallNamedPipeA=CallNamedPipeA@28
|
CallNamedPipeA=CallNamedPipeA@28
|
||||||
CallNamedPipeW=CallNamedPipeW@28
|
CallNamedPipeW=CallNamedPipeW@28
|
||||||
|
CancelIo=CancelIo@4
|
||||||
CancelWaitableTimer=CancelWaitableTimer@4
|
CancelWaitableTimer=CancelWaitableTimer@4
|
||||||
ClearCommBreak=ClearCommBreak@4
|
ClearCommBreak=ClearCommBreak@4
|
||||||
ClearCommError=ClearCommError@12
|
ClearCommError=ClearCommError@12
|
||||||
|
@ -267,6 +268,8 @@ GetExitCodeThread=GetExitCodeThread@8
|
||||||
GetFiberData=GetFiberData@0
|
GetFiberData=GetFiberData@0
|
||||||
GetFileAttributesA=GetFileAttributesA@4
|
GetFileAttributesA=GetFileAttributesA@4
|
||||||
GetFileAttributesW=GetFileAttributesW@4
|
GetFileAttributesW=GetFileAttributesW@4
|
||||||
|
GetFileAttributesExA=GetFileAttributesExA@12
|
||||||
|
GetFileAttributesExW=GetFileAttributesExW@12
|
||||||
GetFileInformationByHandle=GetFileInformationByHandle@8
|
GetFileInformationByHandle=GetFileInformationByHandle@8
|
||||||
GetFileSize=GetFileSize@8
|
GetFileSize=GetFileSize@8
|
||||||
GetFileTime=GetFileTime@16
|
GetFileTime=GetFileTime@16
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include <defines.h>
|
#include <defines.h>
|
||||||
#include <reactos/resource.h>
|
#include <reactos/resource.h>
|
||||||
|
|
||||||
|
|
||||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||||
|
|
||||||
VS_VERSION_INFO VERSIONINFO
|
VS_VERSION_INFO VERSIONINFO
|
||||||
|
@ -36,3 +37,5 @@ BEGIN
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
|
|
||||||
|
|
||||||
|
#include "errcodes.rc"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# $Id: makefile,v 1.56 2003/01/05 10:07:07 robd Exp $
|
# $Id: makefile,v 1.57 2003/01/07 17:29:09 robd Exp $
|
||||||
|
|
||||||
PATH_TO_TOP = ../..
|
PATH_TO_TOP = ../..
|
||||||
|
|
||||||
|
@ -26,6 +26,10 @@ include $(PATH_TO_TOP)/rules.mak
|
||||||
|
|
||||||
include $(TOOLS_PATH)/helper.mk
|
include $(TOOLS_PATH)/helper.mk
|
||||||
|
|
||||||
|
depends:
|
||||||
|
make -f errormsg.mak
|
||||||
|
|
||||||
|
.PHONY: depends
|
||||||
|
|
||||||
SYNCH_OBJECTS = synch/critical.o synch/event.o synch/intrlck.o synch/mutex.o \
|
SYNCH_OBJECTS = synch/critical.o synch/event.o synch/intrlck.o synch/mutex.o \
|
||||||
synch/sem.o synch/timer.o synch/wait.o
|
synch/sem.o synch/timer.o synch/wait.o
|
||||||
|
@ -107,7 +111,7 @@ OBJECTS = $(MISC_OBJECTS) $(FILE_OBJECTS) $(THREAD_OBJECTS) \
|
||||||
#$(NLS_OBJECTS)
|
#$(NLS_OBJECTS)
|
||||||
|
|
||||||
|
|
||||||
$(TARGET_NAME).o: $(OBJECTS)
|
$(TARGET_NAME).o: $(OBJECTS) errcodes.rc
|
||||||
$(LD) -r $(OBJECTS) -o $(TARGET_NAME).o
|
$(LD) -r $(OBJECTS) -o $(TARGET_NAME).o
|
||||||
|
|
||||||
%/TAGS:
|
%/TAGS:
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: errormsg.c,v 1.2 2002/12/08 16:07:17 robd Exp $
|
/* $Id: errormsg.c,v 1.3 2003/01/07 17:29:08 robd Exp $
|
||||||
*
|
*
|
||||||
* reactos/lib/kernel32/misc/errormsg.c
|
* reactos/lib/kernel32/misc/errormsg.c
|
||||||
*
|
*
|
||||||
|
@ -140,7 +140,7 @@ static INT load_messageA( HMODULE instance, UINT id, WORD lang,
|
||||||
PMESSAGE_RESOURCE_ENTRY mre;
|
PMESSAGE_RESOURCE_ENTRY mre;
|
||||||
int i,slen;
|
int i,slen;
|
||||||
|
|
||||||
TRACE("instance = %08lx, id = %08lx, buffer = %p, length = %ld\n", (DWORD)instance, (DWORD)id, buffer, (DWORD)buflen);
|
//TRACE("instance = %08lx, id = %08lx, buffer = %p, length = %ld\n", (DWORD)instance, (DWORD)id, buffer, (DWORD)buflen);
|
||||||
|
|
||||||
/*FIXME: I am not sure about the '1' ... But I've only seen those entries*/
|
/*FIXME: I am not sure about the '1' ... But I've only seen those entries*/
|
||||||
hrsrc = FindResourceExW(instance,RT_MESSAGETABLEW,(LPWSTR)1,lang);
|
hrsrc = FindResourceExW(instance,RT_MESSAGETABLEW,(LPWSTR)1,lang);
|
||||||
|
@ -167,7 +167,7 @@ static INT load_messageA( HMODULE instance, UINT id, WORD lang,
|
||||||
mre = (PMESSAGE_RESOURCE_ENTRY)(((char*)mre)+mre->Length);
|
mre = (PMESSAGE_RESOURCE_ENTRY)(((char*)mre)+mre->Length);
|
||||||
}
|
}
|
||||||
slen=mre->Length;
|
slen=mre->Length;
|
||||||
TRACE(" - strlen=%d\n",slen);
|
//TRACE(" - strlen=%d\n",slen);
|
||||||
i = min(buflen - 1, slen);
|
i = min(buflen - 1, slen);
|
||||||
if (buffer == NULL)
|
if (buffer == NULL)
|
||||||
return slen;
|
return slen;
|
||||||
|
@ -183,8 +183,10 @@ static INT load_messageA( HMODULE instance, UINT id, WORD lang,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (buffer)
|
if (buffer) {
|
||||||
TRACE("'%s' copied !\n", buffer);
|
//TRACE("'%s' copied !\n", buffer);
|
||||||
|
TRACE("'%s'\n", buffer);
|
||||||
|
}
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -238,8 +240,7 @@ DWORD WINAPI FormatMessageA(
|
||||||
HMODULE hmodule = (HMODULE)lpSource;
|
HMODULE hmodule = (HMODULE)lpSource;
|
||||||
CHAR ch;
|
CHAR ch;
|
||||||
|
|
||||||
TRACE("(0x%lx,%p,%ld,0x%lx,%p,%ld,%p)\n",
|
//TRACE("(0x%lx,%p,%ld,0x%lx,%p,%ld,%p)\n", dwFlags,lpSource,dwMessageId,dwLanguageId,lpBuffer,nSize,args);
|
||||||
dwFlags,lpSource,dwMessageId,dwLanguageId,lpBuffer,nSize,args);
|
|
||||||
if ((dwFlags & FORMAT_MESSAGE_FROM_STRING)
|
if ((dwFlags & FORMAT_MESSAGE_FROM_STRING)
|
||||||
&&((dwFlags & FORMAT_MESSAGE_FROM_SYSTEM)
|
&&((dwFlags & FORMAT_MESSAGE_FROM_SYSTEM)
|
||||||
|| (dwFlags & FORMAT_MESSAGE_FROM_HMODULE))) return 0;
|
|| (dwFlags & FORMAT_MESSAGE_FROM_HMODULE))) return 0;
|
||||||
|
@ -454,7 +455,7 @@ DWORD WINAPI FormatMessageA(
|
||||||
}
|
}
|
||||||
HeapFree(GetProcessHeap(),0,target);
|
HeapFree(GetProcessHeap(),0,target);
|
||||||
if (from) HeapFree(GetProcessHeap(),0,from);
|
if (from) HeapFree(GetProcessHeap(),0,from);
|
||||||
TRACE("-- returning %d\n", (dwFlags & FORMAT_MESSAGE_ALLOCATE_BUFFER) ? strlen(*(LPSTR*)lpBuffer):strlen(lpBuffer));
|
//TRACE("-- returning %d\n", (dwFlags & FORMAT_MESSAGE_ALLOCATE_BUFFER) ? strlen(*(LPSTR*)lpBuffer):strlen(lpBuffer));
|
||||||
return (dwFlags & FORMAT_MESSAGE_ALLOCATE_BUFFER) ?
|
return (dwFlags & FORMAT_MESSAGE_ALLOCATE_BUFFER) ?
|
||||||
strlen(*(LPSTR*)lpBuffer):
|
strlen(*(LPSTR*)lpBuffer):
|
||||||
strlen(lpBuffer);
|
strlen(lpBuffer);
|
||||||
|
@ -489,8 +490,7 @@ DWORD WINAPI FormatMessageW(
|
||||||
HMODULE hmodule = (HMODULE)lpSource;
|
HMODULE hmodule = (HMODULE)lpSource;
|
||||||
CHAR ch;
|
CHAR ch;
|
||||||
|
|
||||||
TRACE("(0x%lx,%p,%ld,0x%lx,%p,%ld,%p)\n",
|
//TRACE("(0x%lx,%p,%ld,0x%lx,%p,%ld,%p)\n", dwFlags,lpSource,dwMessageId,dwLanguageId,lpBuffer,nSize,args);
|
||||||
dwFlags,lpSource,dwMessageId,dwLanguageId,lpBuffer,nSize,args);
|
|
||||||
if ((dwFlags & FORMAT_MESSAGE_FROM_STRING)
|
if ((dwFlags & FORMAT_MESSAGE_FROM_STRING)
|
||||||
&&((dwFlags & FORMAT_MESSAGE_FROM_SYSTEM)
|
&&((dwFlags & FORMAT_MESSAGE_FROM_SYSTEM)
|
||||||
|| (dwFlags & FORMAT_MESSAGE_FROM_HMODULE))) return 0;
|
|| (dwFlags & FORMAT_MESSAGE_FROM_HMODULE))) return 0;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: stubs.c,v 1.40 2003/01/05 10:07:08 robd Exp $
|
/* $Id: stubs.c,v 1.41 2003/01/07 17:29:09 robd Exp $
|
||||||
*
|
*
|
||||||
* KERNEL32.DLL stubs (unimplemented functions)
|
* KERNEL32.DLL stubs (unimplemented functions)
|
||||||
* Remove from this file, if you implement them.
|
* Remove from this file, if you implement them.
|
||||||
|
@ -1023,4 +1023,29 @@ VirtualBufferExceptionHandler (
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
STDCALL
|
||||||
|
GetFileAttributesExA(
|
||||||
|
LPCSTR lpFileName,
|
||||||
|
GET_FILEEX_INFO_LEVELS fInfoLevelId,
|
||||||
|
LPVOID lpFileInformation
|
||||||
|
)
|
||||||
|
{
|
||||||
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
STDCALL
|
||||||
|
GetFileAttributesExW(
|
||||||
|
LPCWSTR lpFileName,
|
||||||
|
GET_FILEEX_INFO_LEVELS fInfoLevelId,
|
||||||
|
LPVOID lpFileInformation
|
||||||
|
)
|
||||||
|
{
|
||||||
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: create.c,v 1.57 2002/11/05 20:54:10 hbirr Exp $
|
/* $Id: create.c,v 1.58 2003/01/07 17:29:08 robd Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS system libraries
|
* PROJECT: ReactOS system libraries
|
||||||
|
@ -25,7 +25,7 @@
|
||||||
#include <csrss/csrss.h>
|
#include <csrss/csrss.h>
|
||||||
#include <ntdll/csr.h>
|
#include <ntdll/csr.h>
|
||||||
|
|
||||||
#define NDEBUG
|
#define DBG
|
||||||
#include <kernel32/kernel32.h>
|
#include <kernel32/kernel32.h>
|
||||||
#include <kernel32/error.h>
|
#include <kernel32/error.h>
|
||||||
|
|
||||||
|
@ -167,6 +167,8 @@ CreateProcessA (LPCSTR lpApplicationName,
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int _except_recursion_trap = 0;
|
||||||
|
|
||||||
struct _CONTEXT;
|
struct _CONTEXT;
|
||||||
struct __EXCEPTION_RECORD;
|
struct __EXCEPTION_RECORD;
|
||||||
|
|
||||||
|
@ -181,15 +183,25 @@ _except_handler(
|
||||||
{
|
{
|
||||||
DPRINT("Process terminated abnormally...\n");
|
DPRINT("Process terminated abnormally...\n");
|
||||||
|
|
||||||
|
if (++_except_recursion_trap > 3) {
|
||||||
|
DPRINT("_except_handler(...) appears to be recursing.\n");
|
||||||
|
DPRINT("Process HALTED.\n");
|
||||||
|
for (;;) {}
|
||||||
|
}
|
||||||
|
|
||||||
if (/* FIXME: */ TRUE) /* Not a service */
|
if (/* FIXME: */ TRUE) /* Not a service */
|
||||||
{
|
{
|
||||||
ExitProcess(0);
|
DPRINT(" calling ExitProcess(0) no, lets try ExitThread . . .\n");
|
||||||
|
//ExitProcess(0);
|
||||||
|
ExitThread(0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
DPRINT(" calling ExitThread(0) . . .\n");
|
||||||
ExitThread(0);
|
ExitThread(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DPRINT(" We should not get to here !!!\n");
|
||||||
/* We should not get to here */
|
/* We should not get to here */
|
||||||
return ExceptionContinueSearch;
|
return ExceptionContinueSearch;
|
||||||
}
|
}
|
||||||
|
@ -200,6 +212,8 @@ BaseProcessStart(LPTHREAD_START_ROUTINE lpStartAddress,
|
||||||
{
|
{
|
||||||
UINT uExitCode = 0;
|
UINT uExitCode = 0;
|
||||||
|
|
||||||
|
DPRINT("\nBaseProcessStart(..) - setting up exception frame.\n\n");
|
||||||
|
|
||||||
__try1(_except_handler)
|
__try1(_except_handler)
|
||||||
{
|
{
|
||||||
uExitCode = (lpStartAddress)((PVOID)lpParameter);
|
uExitCode = (lpStartAddress)((PVOID)lpParameter);
|
||||||
|
@ -207,6 +221,8 @@ BaseProcessStart(LPTHREAD_START_ROUTINE lpStartAddress,
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DPRINT("\nBaseProcessStart(..) - cleaned up exception frame.\n\n");
|
||||||
|
|
||||||
ExitThread(uExitCode);
|
ExitThread(uExitCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -534,7 +550,7 @@ KlInitPeb (HANDLE ProcessHandle,
|
||||||
return(Status);
|
return(Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
DPRINT("Ppb->MaximumLength %x\n", Ppb->MaximumLength);
|
//DPRINT("Ppb->MaximumLength %x\n", Ppb->MaximumLength);
|
||||||
NtWriteVirtualMemory(ProcessHandle,
|
NtWriteVirtualMemory(ProcessHandle,
|
||||||
PpbBase,
|
PpbBase,
|
||||||
Ppb,
|
Ppb,
|
||||||
|
@ -743,9 +759,94 @@ CreateProcessW(LPCWSTR lpApplicationName,
|
||||||
hSection = KlMapFile (ImagePathName);
|
hSection = KlMapFile (ImagePathName);
|
||||||
if (hSection == NULL)
|
if (hSection == NULL)
|
||||||
{
|
{
|
||||||
|
/////////////////////////////////////////
|
||||||
|
/*
|
||||||
|
* Inspect the image to determine executable flavour
|
||||||
|
*/
|
||||||
|
IO_STATUS_BLOCK IoStatusBlock;
|
||||||
|
UNICODE_STRING ApplicationNameString;
|
||||||
|
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||||
|
PSECURITY_DESCRIPTOR SecurityDescriptor = NULL;
|
||||||
|
IMAGE_DOS_HEADER DosHeader;
|
||||||
|
IO_STATUS_BLOCK Iosb;
|
||||||
|
LARGE_INTEGER Offset;
|
||||||
|
HANDLE hFile = NULL;
|
||||||
|
|
||||||
|
DPRINT("Inspecting Image Header for image type id\n");
|
||||||
|
|
||||||
|
// Find the application name
|
||||||
|
if (!RtlDosPathNameToNtPathName_U((LPWSTR)lpApplicationName,
|
||||||
|
&ApplicationNameString, NULL, NULL)) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
DPRINT("ApplicationName %S\n",ApplicationNameString.Buffer);
|
||||||
|
|
||||||
|
InitializeObjectAttributes(&ObjectAttributes,
|
||||||
|
&ApplicationNameString,
|
||||||
|
OBJ_CASE_INSENSITIVE,
|
||||||
|
NULL,
|
||||||
|
SecurityDescriptor);
|
||||||
|
|
||||||
|
// Try to open the executable
|
||||||
|
Status = NtOpenFile(&hFile,
|
||||||
|
SYNCHRONIZE|FILE_EXECUTE|FILE_READ_DATA,
|
||||||
|
&ObjectAttributes,
|
||||||
|
&IoStatusBlock,
|
||||||
|
FILE_SHARE_DELETE|FILE_SHARE_READ,
|
||||||
|
FILE_SYNCHRONOUS_IO_NONALERT|FILE_NON_DIRECTORY_FILE);
|
||||||
|
|
||||||
|
RtlFreeUnicodeString(&ApplicationNameString);
|
||||||
|
|
||||||
|
if (!NT_SUCCESS(Status)) {
|
||||||
|
DPRINT("Failed to open file\n");
|
||||||
|
SetLastErrorByStatus(Status);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Read the dos header
|
||||||
|
Offset.QuadPart = 0;
|
||||||
|
Status = ZwReadFile(hFile,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
&Iosb,
|
||||||
|
&DosHeader,
|
||||||
|
sizeof(DosHeader),
|
||||||
|
&Offset,
|
||||||
|
0);
|
||||||
|
|
||||||
|
if (!NT_SUCCESS(Status)) {
|
||||||
|
DPRINT("Failed to read from file\n");
|
||||||
|
SetLastErrorByStatus(Status);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
if (Iosb.Information != sizeof(DosHeader)) {
|
||||||
|
DPRINT("Failed to read dos header from file\n");
|
||||||
|
SetLastErrorByStatus(STATUS_INVALID_IMAGE_FORMAT);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check the DOS signature
|
||||||
|
if (DosHeader.e_magic != IMAGE_DOS_SIGNATURE) {
|
||||||
|
DPRINT("Failed dos magic check\n");
|
||||||
|
SetLastErrorByStatus(STATUS_INVALID_IMAGE_FORMAT);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
NtClose(hFile);
|
||||||
|
|
||||||
|
DPRINT("Launching VDM...\n");
|
||||||
|
return CreateProcessW(L"ntvdm.exe",
|
||||||
|
lpApplicationName,
|
||||||
|
lpProcessAttributes,
|
||||||
|
lpThreadAttributes,
|
||||||
|
bInheritHandles,
|
||||||
|
dwCreationFlags,
|
||||||
|
lpEnvironment,
|
||||||
|
lpCurrentDirectory,
|
||||||
|
lpStartupInfo,
|
||||||
|
lpProcessInformation);
|
||||||
|
}
|
||||||
|
/////////////////////////////////////////
|
||||||
/*
|
/*
|
||||||
* Create a new process
|
* Create a new process
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue