-/* $Id: ntvdm.c,v 1.2 2003/01/12 01:54:40 robd Exp $
- *
+/* $Id$
+ *
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: subsys/ntvdm/ntvdm->c
*/
/* INCLUDES *****************************************************************/
-
-#include <ntos.h>
+#define WIN32_NO_STATUS
#include <windows.h>
#include <stdio.h>
#include <wchar.h>
+#include "resource.h"
+
+#define NTOS_MODE_USER
+#include <ndk/ntndk.h>
#define NDEBUG
#include <debug.h>
vsprintf(buffer, fmt, ap);
va_end(ap);
- OutputDebugString(buffer);
+ OutputDebugStringA(buffer);
}
/*
StartVDM(PVDM_CONTROL_BLOCK vdm)
{
BOOL Result;
- STARTUPINFO StartupInfo;
+ STARTUPINFOA StartupInfo;
StartupInfo.cb = sizeof(StartupInfo);
StartupInfo.lpReserved = NULL;
StartupInfo.cbReserved2 = 0;
StartupInfo.lpReserved2 = 0;
- Result = CreateProcess(vdm->CommandLine,
+ Result = CreateProcessA(vdm->CommandLine,
NULL,
NULL,
NULL,
BOOL result = TRUE;
DWORD dwError;
HANDLE hFile;
-
+
hFile = CreateFileW(L"\\system32\\config.nt",
GENERIC_READ,
FILE_SHARE_READ,
LoadConfigDriversForVDM(PVDM_CONFIG vdmConfig)
{
BOOL result = TRUE;
-
+
return result;
}
SetConfigOptionsForVDM(PVDM_AUTOEXEC vdmAutoexec)
{
BOOL result = TRUE;
-
+
return result;
}
// BOOL result = TRUE;
SYSTEM_INFO inf;
MEMORYSTATUS stat;
- PVOID lpMem = NULL;
+
GlobalMemoryStatus(&stat);
if (stat.dwLength != sizeof(MEMORYSTATUS)) {
//SetLastError();
return FALSE;
}
+
}
-
+
GetSystemInfo(&inf);
vdm->hHeap = HeapCreate(0, inf.dwAllocationGranularity, 0);
if (vdm->hHeap == NULL) {
{
VDM_CONTROL_BLOCK VdmCB;
DWORD Result;
- BOOL Success;
ULONG i;
- NTSTATUS Status;
BOOL vdmStarted = FALSE;
- CHAR WelcomeMsg[] = "ReactOS Virtual DOS Machine support.\n";
- CHAR PromptMsg[] = "Type r<cr> to run, s<cr> to shutdown or q<cr> to quit now.";
+ WCHAR WelcomeMsg[RC_STRING_MAX_SIZE];
+ WCHAR PromptMsg[RC_STRING_MAX_SIZE];
CHAR InputBuffer[255];
-
+
+ LoadString( GetModuleHandle(NULL), STRING_WelcomeMsg, (LPTSTR) WelcomeMsg,sizeof(WelcomeMsg) / sizeof(WelcomeMsg[0]));
+ LoadString( GetModuleHandle(NULL), STRING_PromptMsg, (LPTSTR) PromptMsg ,sizeof(PromptMsg) / sizeof(PromptMsg[0]));
+
AllocConsole();
- SetConsoleTitle("ntvdm");
-
- WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE),
- WelcomeMsg, strlen(WelcomeMsg), // wcslen(WelcomeMsg),
+ SetConsoleTitleW(L"ntvdm");
+
+ WriteConsoleW(GetStdHandle(STD_OUTPUT_HANDLE),
+ WelcomeMsg, lstrlenW(WelcomeMsg), // wcslen(WelcomeMsg),
&Result, NULL);
if (!CreateVDM(&VdmCB)) {
//SetLastError();
return 2;
}
-
+
ReadConfigForVDM(&VdmCB);
if (!LoadConfigDriversForVDM(&(VdmCB.vdmConfig))) {
//SetLastError();
return 3;
}
-
- GetSystemDirectory(VdmCB.CommandLine, MAX_PATH);
+
+ GetSystemDirectoryA(VdmCB.CommandLine, MAX_PATH);
strcat(VdmCB.CommandLine, "\\hello.exe");
- GetWindowsDirectory(VdmCB.CurrentDirectory, MAX_PATH);
+ GetWindowsDirectoryA(VdmCB.CurrentDirectory, MAX_PATH);
for (;;) {
- WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE),
- PromptMsg, strlen(PromptMsg), // wcslen(PromptMsg),
+ WriteConsoleW(GetStdHandle(STD_OUTPUT_HANDLE),
+ PromptMsg, lstrlenW(PromptMsg), // wcslen(PromptMsg),
&Result, NULL);
i = 0;
do {
- ReadConsole(GetStdHandle(STD_INPUT_HANDLE),
+ ReadConsoleA(GetStdHandle(STD_INPUT_HANDLE),
&InputBuffer[i], 1,
&Result, NULL);
if (++i >= (sizeof(InputBuffer) - 1)) {