mirror of
https://github.com/reactos/reactos.git
synced 2024-07-14 16:36:09 +00:00
[KERNEL32]: Now that we have the BaseStaticServerData initialized, don't build the \ReactOS and \ReactOS\System32 paths by hand: use the ones we have.
[KERNEL32]: Same goes for BaseCachedSysInfo. Use the BaseStaticServerData->SysInfo instead now. [KERNEL32]: Don't assume that the BNO directory is called BaseNamedObjects (this won't be true once GedMurphy's dream of multi-session support comes true) -- instead, use the one from BaseStaticServerData. svn path=/trunk/; revision=52872
This commit is contained in:
parent
64c8e2bb02
commit
7a69501f10
|
@ -29,6 +29,7 @@ BOOLEAN BaseRunningInServerProcess;
|
||||||
|
|
||||||
WCHAR BaseDefaultPathBuffer[6140];
|
WCHAR BaseDefaultPathBuffer[6140];
|
||||||
|
|
||||||
|
HANDLE BaseNamedObjectDirectory;
|
||||||
HANDLE hProcessHeap = NULL;
|
HANDLE hProcessHeap = NULL;
|
||||||
HMODULE hCurrentModule = NULL;
|
HMODULE hCurrentModule = NULL;
|
||||||
HMODULE kernel32_handle = NULL;
|
HMODULE kernel32_handle = NULL;
|
||||||
|
@ -36,7 +37,7 @@ HANDLE hBaseDir = NULL;
|
||||||
PPEB Peb;
|
PPEB Peb;
|
||||||
ULONG SessionId;
|
ULONG SessionId;
|
||||||
BOOL ConsoleInitialized = FALSE;
|
BOOL ConsoleInitialized = FALSE;
|
||||||
|
UNICODE_STRING BaseWindowsDirectory, BaseWindowsSystemDirectory;
|
||||||
static BOOL DllInitialized = FALSE;
|
static BOOL DllInitialized = FALSE;
|
||||||
|
|
||||||
BOOL WINAPI
|
BOOL WINAPI
|
||||||
|
@ -68,34 +69,28 @@ DuplicateConsoleHandle(HANDLE hConsole,
|
||||||
#define WIN_OBJ_DIR L"\\Windows"
|
#define WIN_OBJ_DIR L"\\Windows"
|
||||||
#define SESSION_DIR L"\\Sessions"
|
#define SESSION_DIR L"\\Sessions"
|
||||||
|
|
||||||
SYSTEM_BASIC_INFORMATION BaseCachedSysInfo;
|
|
||||||
|
|
||||||
/* FUNCTIONS *****************************************************************/
|
/* FUNCTIONS *****************************************************************/
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
WINAPI
|
WINAPI
|
||||||
OpenBaseDirectory(PHANDLE DirHandle)
|
BaseGetNamedObjectDirectory(VOID)
|
||||||
{
|
{
|
||||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||||
UNICODE_STRING Name = RTL_CONSTANT_STRING(L"\\BaseNamedObjects");
|
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
InitializeObjectAttributes(&ObjectAttributes,
|
InitializeObjectAttributes(&ObjectAttributes,
|
||||||
&Name,
|
&BaseStaticServerData->NamedObjectDirectory,
|
||||||
OBJ_CASE_INSENSITIVE,
|
OBJ_CASE_INSENSITIVE,
|
||||||
NULL,
|
NULL,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
Status = NtOpenDirectoryObject(DirHandle,
|
Status = NtOpenDirectoryObject(&BaseNamedObjectDirectory,
|
||||||
DIRECTORY_ALL_ACCESS &
|
DIRECTORY_ALL_ACCESS &
|
||||||
~(DELETE | WRITE_DAC | WRITE_OWNER),
|
~(DELETE | WRITE_DAC | WRITE_OWNER),
|
||||||
&ObjectAttributes);
|
&ObjectAttributes);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status)) return Status;
|
||||||
{
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
DPRINT("Opened BNO: %lx\n", *DirHandle);
|
DPRINT("Opened BNO: %lx\n", BaseNamedObjectDirectory);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,8 +139,8 @@ BasepInitConsole(VOID)
|
||||||
WCHAR lpTest[MAX_PATH];
|
WCHAR lpTest[MAX_PATH];
|
||||||
GetModuleFileNameW(NULL, lpTest, MAX_PATH);
|
GetModuleFileNameW(NULL, lpTest, MAX_PATH);
|
||||||
DPRINT("BasepInitConsole for : %S\n", lpTest);
|
DPRINT("BasepInitConsole for : %S\n", lpTest);
|
||||||
DPRINT("Our current console handles are: %lx, %lx, %lx %lx\n",
|
DPRINT("Our current console handles are: %lx, %lx, %lx %lx\n",
|
||||||
Parameters->ConsoleHandle, Parameters->StandardInput,
|
Parameters->ConsoleHandle, Parameters->StandardInput,
|
||||||
Parameters->StandardOutput, Parameters->StandardError);
|
Parameters->StandardOutput, Parameters->StandardError);
|
||||||
|
|
||||||
/* We have nothing to do if this isn't a console app... */
|
/* We have nothing to do if this isn't a console app... */
|
||||||
|
@ -204,7 +199,7 @@ BasepInitConsole(VOID)
|
||||||
ExeName = wcsrchr(Parameters->ImagePathName.Buffer, L'\\');
|
ExeName = wcsrchr(Parameters->ImagePathName.Buffer, L'\\');
|
||||||
if (ExeName)
|
if (ExeName)
|
||||||
SetConsoleInputExeNameW(ExeName + 1);
|
SetConsoleInputExeNameW(ExeName + 1);
|
||||||
|
|
||||||
/* Now use the proper console handle */
|
/* Now use the proper console handle */
|
||||||
Request.Data.AllocConsoleRequest.Console = Parameters->ConsoleHandle;
|
Request.Data.AllocConsoleRequest.Console = Parameters->ConsoleHandle;
|
||||||
|
|
||||||
|
@ -216,7 +211,7 @@ BasepInitConsole(VOID)
|
||||||
*/
|
*/
|
||||||
CsrRequest = MAKE_CSR_API(ALLOC_CONSOLE, CSR_CONSOLE);
|
CsrRequest = MAKE_CSR_API(ALLOC_CONSOLE, CSR_CONSOLE);
|
||||||
Request.Data.AllocConsoleRequest.CtrlDispatcher = ConsoleControlDispatcher;
|
Request.Data.AllocConsoleRequest.CtrlDispatcher = ConsoleControlDispatcher;
|
||||||
Status = CsrClientCallServer(&Request,
|
Status = CsrClientCallServer(&Request,
|
||||||
NULL,
|
NULL,
|
||||||
CsrRequest,
|
CsrRequest,
|
||||||
sizeof(CSR_API_MESSAGE));
|
sizeof(CSR_API_MESSAGE));
|
||||||
|
@ -226,7 +221,7 @@ BasepInitConsole(VOID)
|
||||||
/* We're lying here, so at least the process can load... */
|
/* We're lying here, so at least the process can load... */
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NotConsole) return TRUE;
|
if (NotConsole) return TRUE;
|
||||||
|
|
||||||
/* We got the handles, let's set them */
|
/* We got the handles, let's set them */
|
||||||
|
@ -247,7 +242,7 @@ BasepInitConsole(VOID)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DPRINT("Console setup: %lx, %lx, %lx, %lx\n",
|
DPRINT("Console setup: %lx, %lx, %lx, %lx\n",
|
||||||
Parameters->ConsoleHandle,
|
Parameters->ConsoleHandle,
|
||||||
Parameters->StandardInput,
|
Parameters->StandardInput,
|
||||||
Parameters->StandardOutput,
|
Parameters->StandardOutput,
|
||||||
|
@ -274,7 +269,7 @@ BasepFakeStaticServerData(VOID)
|
||||||
},
|
},
|
||||||
{0}
|
{0}
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Allocate the fake data */
|
/* Allocate the fake data */
|
||||||
BaseStaticServerData = RtlAllocateHeap(RtlGetProcessHeap(),
|
BaseStaticServerData = RtlAllocateHeap(RtlGetProcessHeap(),
|
||||||
HEAP_ZERO_MEMORY,
|
HEAP_ZERO_MEMORY,
|
||||||
|
@ -305,13 +300,13 @@ BasepFakeStaticServerData(VOID)
|
||||||
Status = RtlCreateUnicodeString(&BaseStaticServerData->NamedObjectDirectory,
|
Status = RtlCreateUnicodeString(&BaseStaticServerData->NamedObjectDirectory,
|
||||||
L"\\BaseNamedObjects");
|
L"\\BaseNamedObjects");
|
||||||
ASSERT(NT_SUCCESS(Status));
|
ASSERT(NT_SUCCESS(Status));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Hopefully we'll fix CSRSS Before we add multiple sessions... */
|
/* Hopefully we'll fix CSRSS Before we add multiple sessions... */
|
||||||
ASSERT(FALSE);
|
ASSERT(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Confirmed that in Windows, CSDNumber and RCNumber are actually Length
|
* Confirmed that in Windows, CSDNumber and RCNumber are actually Length
|
||||||
* and MaximumLength of the CSD String, since the same UNICODE_STRING is
|
* and MaximumLength of the CSD String, since the same UNICODE_STRING is
|
||||||
|
@ -319,10 +314,10 @@ BasepFakeStaticServerData(VOID)
|
||||||
*
|
*
|
||||||
* Somehow, in Windows this doesn't cause a buffer overflow, but it might
|
* Somehow, in Windows this doesn't cause a buffer overflow, but it might
|
||||||
* in ReactOS, so this code is disabled until someone figures out WTF.
|
* in ReactOS, so this code is disabled until someone figures out WTF.
|
||||||
*/
|
*/
|
||||||
BaseStaticServerData->CSDNumber = 0;
|
BaseStaticServerData->CSDNumber = 0;
|
||||||
BaseStaticServerData->RCNumber = 0;
|
BaseStaticServerData->RCNumber = 0;
|
||||||
|
|
||||||
/* Initialize the CSD string */
|
/* Initialize the CSD string */
|
||||||
RtlInitEmptyUnicodeString(&BaseSrvCSDString, Buffer, sizeof(Buffer));
|
RtlInitEmptyUnicodeString(&BaseSrvCSDString, Buffer, sizeof(Buffer));
|
||||||
|
|
||||||
|
@ -333,7 +328,6 @@ BasepFakeStaticServerData(VOID)
|
||||||
NULL);
|
NULL);
|
||||||
if (NT_SUCCESS(Status))
|
if (NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT1("CSD String: %wZ\n", &BaseSrvCSDString);
|
|
||||||
wcsncpy(BaseStaticServerData->CSDVersion,
|
wcsncpy(BaseStaticServerData->CSDVersion,
|
||||||
BaseSrvCSDString.Buffer,
|
BaseSrvCSDString.Buffer,
|
||||||
BaseSrvCSDString.Length / sizeof(WCHAR));
|
BaseSrvCSDString.Length / sizeof(WCHAR));
|
||||||
|
@ -348,7 +342,7 @@ BasepFakeStaticServerData(VOID)
|
||||||
sizeof(BaseStaticServerData->SysInfo),
|
sizeof(BaseStaticServerData->SysInfo),
|
||||||
NULL);
|
NULL);
|
||||||
ASSERT(NT_SUCCESS(Status));
|
ASSERT(NT_SUCCESS(Status));
|
||||||
|
|
||||||
BaseStaticServerData->DefaultSeparateVDM = FALSE;
|
BaseStaticServerData->DefaultSeparateVDM = FALSE;
|
||||||
BaseStaticServerData->IsWowTaskReady = FALSE;
|
BaseStaticServerData->IsWowTaskReady = FALSE;
|
||||||
BaseStaticServerData->LUIDDeviceMapsEnabled = FALSE;
|
BaseStaticServerData->LUIDDeviceMapsEnabled = FALSE;
|
||||||
|
@ -360,14 +354,6 @@ BasepFakeStaticServerData(VOID)
|
||||||
sizeof(BaseStaticServerData->TimeOfDay),
|
sizeof(BaseStaticServerData->TimeOfDay),
|
||||||
NULL);
|
NULL);
|
||||||
ASSERT(NT_SUCCESS(Status));
|
ASSERT(NT_SUCCESS(Status));
|
||||||
|
|
||||||
DPRINT1("ReactOS Base API Connected: %wZ %wZ %wZ %S %d KB\n",
|
|
||||||
&BaseStaticServerData->WindowsDirectory,
|
|
||||||
&BaseStaticServerData->WindowsSystemDirectory,
|
|
||||||
&BaseStaticServerData->NamedObjectDirectory,
|
|
||||||
BaseStaticServerData->CSDVersion,
|
|
||||||
BaseStaticServerData->SysInfo.PageSize *
|
|
||||||
BaseStaticServerData->SysInfo.NumberOfPhysicalPages / 1024);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL
|
BOOL
|
||||||
|
@ -429,26 +415,24 @@ DllMain(HANDLE hDll,
|
||||||
ZwTerminateProcess(NtCurrentProcess(), Status);
|
ZwTerminateProcess(NtCurrentProcess(), Status);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the server data */
|
/* Get the server data */
|
||||||
DPRINT1("Server data: %p\n", Peb->ReadOnlyStaticServerData);
|
|
||||||
if (!Peb->ReadOnlyStaticServerData)
|
if (!Peb->ReadOnlyStaticServerData)
|
||||||
{
|
{
|
||||||
/* Build fake one for ReactOS */
|
/* Build fake one for ReactOS */
|
||||||
BasepFakeStaticServerData();
|
BasepFakeStaticServerData();
|
||||||
|
|
||||||
/* Allocate the array */
|
/* Allocate the array */
|
||||||
Peb->ReadOnlyStaticServerData = RtlAllocateHeap(RtlGetProcessHeap(),
|
Peb->ReadOnlyStaticServerData = RtlAllocateHeap(RtlGetProcessHeap(),
|
||||||
HEAP_ZERO_MEMORY,
|
HEAP_ZERO_MEMORY,
|
||||||
4 * sizeof(PVOID));
|
4 * sizeof(PVOID));
|
||||||
|
|
||||||
/* Set the data for the BASESRV DLL Index */
|
/* Set the data for the BASESRV DLL Index */
|
||||||
Peb->ReadOnlyStaticServerData[CSR_CONSOLE] = BaseStaticServerData;
|
Peb->ReadOnlyStaticServerData[CSR_CONSOLE] = BaseStaticServerData;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the server data */
|
/* Get the server data */
|
||||||
BaseStaticServerData = Peb->ReadOnlyStaticServerData[CSR_CONSOLE];
|
BaseStaticServerData = Peb->ReadOnlyStaticServerData[CSR_CONSOLE];
|
||||||
DPRINT1("Static data: %p\n", BaseStaticServerData);
|
|
||||||
ASSERT(BaseStaticServerData);
|
ASSERT(BaseStaticServerData);
|
||||||
|
|
||||||
/* Check if we are running a CSR Server */
|
/* Check if we are running a CSR Server */
|
||||||
|
@ -459,30 +443,21 @@ DllMain(HANDLE hDll,
|
||||||
CsrNewThread();
|
CsrNewThread();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Initialize heap handle table */
|
||||||
hProcessHeap = RtlGetProcessHeap();
|
hProcessHeap = RtlGetProcessHeap();
|
||||||
RtlInitializeHandleTable(0xFFFF,
|
RtlInitializeHandleTable(0xFFFF,
|
||||||
sizeof(BASE_HEAP_HANDLE_ENTRY),
|
sizeof(BASE_HEAP_HANDLE_ENTRY),
|
||||||
&BaseHeapHandleTable);
|
&BaseHeapHandleTable);
|
||||||
kernel32_handle = hCurrentModule = hDll;
|
|
||||||
DPRINT("Heap: %p\n", hProcessHeap);
|
DPRINT("Heap: %p\n", hProcessHeap);
|
||||||
|
|
||||||
/*
|
/* Set HMODULE for our DLL */
|
||||||
* Initialize WindowsDirectory and SystemDirectory
|
kernel32_handle = hCurrentModule = hDll;
|
||||||
*/
|
|
||||||
DPRINT("NtSystemRoot: %S\n", SharedUserData->NtSystemRoot);
|
/* Set the directories */
|
||||||
RtlCreateUnicodeString (&WindowsDirectory, SharedUserData->NtSystemRoot);
|
BaseWindowsDirectory = BaseStaticServerData->WindowsDirectory;
|
||||||
SystemDirectory.MaximumLength = WindowsDirectory.MaximumLength + 18;
|
BaseWindowsSystemDirectory = BaseStaticServerData->WindowsSystemDirectory;
|
||||||
SystemDirectory.Length = WindowsDirectory.Length + 18;
|
SystemDirectory = BaseWindowsSystemDirectory;
|
||||||
SystemDirectory.Buffer = RtlAllocateHeap(hProcessHeap,
|
WindowsDirectory = BaseWindowsDirectory;
|
||||||
0,
|
|
||||||
SystemDirectory.MaximumLength);
|
|
||||||
if(SystemDirectory.Buffer == NULL)
|
|
||||||
{
|
|
||||||
DPRINT1("Failure allocating SystemDirectory buffer\n");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
wcscpy(SystemDirectory.Buffer, WindowsDirectory.Buffer);
|
|
||||||
wcscat(SystemDirectory.Buffer, L"\\System32");
|
|
||||||
|
|
||||||
/* Construct the default path (using the static buffer) */
|
/* Construct the default path (using the static buffer) */
|
||||||
_snwprintf(BaseDefaultPathBuffer, sizeof(BaseDefaultPathBuffer) / sizeof(WCHAR),
|
_snwprintf(BaseDefaultPathBuffer, sizeof(BaseDefaultPathBuffer) / sizeof(WCHAR),
|
||||||
|
@ -501,7 +476,8 @@ DllMain(HANDLE hDll,
|
||||||
InitCommandLines();
|
InitCommandLines();
|
||||||
|
|
||||||
/* Open object base directory */
|
/* Open object base directory */
|
||||||
Status = OpenBaseDirectory(&hBaseDir);
|
Status = BaseGetNamedObjectDirectory();
|
||||||
|
hBaseDir = BaseNamedObjectDirectory;
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT1("Failed to open object base directory (Status %lx)\n", Status);
|
DPRINT1("Failed to open object base directory (Status %lx)\n", Status);
|
||||||
|
@ -525,17 +501,6 @@ DllMain(HANDLE hDll,
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Cache static system information */
|
|
||||||
Status = ZwQuerySystemInformation(SystemBasicInformation,
|
|
||||||
&BaseCachedSysInfo,
|
|
||||||
sizeof(BaseCachedSysInfo),
|
|
||||||
NULL);
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
DPRINT1("Failure to get system information\n");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Insert more dll attach stuff here! */
|
/* Insert more dll attach stuff here! */
|
||||||
DllInitialized = TRUE;
|
DllInitialized = TRUE;
|
||||||
DPRINT("Initialization complete\n");
|
DPRINT("Initialization complete\n");
|
||||||
|
@ -559,9 +524,6 @@ DllMain(HANDLE hDll,
|
||||||
|
|
||||||
/* Close object base directory */
|
/* Close object base directory */
|
||||||
NtClose(hBaseDir);
|
NtClose(hBaseDir);
|
||||||
|
|
||||||
RtlFreeUnicodeString (&SystemDirectory);
|
|
||||||
RtlFreeUnicodeString (&WindowsDirectory);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -454,7 +454,7 @@ IsBadReadPtr(IN LPCVOID lp,
|
||||||
if (!lp) return TRUE;
|
if (!lp) return TRUE;
|
||||||
|
|
||||||
/* Get the page size */
|
/* Get the page size */
|
||||||
PageSize = BaseCachedSysInfo.PageSize;
|
PageSize = BaseStaticServerData->SysInfo.PageSize;
|
||||||
|
|
||||||
/* Calculate the last page */
|
/* Calculate the last page */
|
||||||
Last = (PCHAR)((ULONG_PTR)lp + ucb - 1);
|
Last = (PCHAR)((ULONG_PTR)lp + ucb - 1);
|
||||||
|
@ -526,7 +526,7 @@ IsBadWritePtr(LPVOID lp,
|
||||||
if (!lp) return TRUE;
|
if (!lp) return TRUE;
|
||||||
|
|
||||||
/* Get the page size */
|
/* Get the page size */
|
||||||
PageSize = BaseCachedSysInfo.PageSize;
|
PageSize = BaseStaticServerData->SysInfo.PageSize;
|
||||||
|
|
||||||
/* Calculate the last page */
|
/* Calculate the last page */
|
||||||
Last = (PCHAR)((ULONG_PTR)lp + ucb - 1);
|
Last = (PCHAR)((ULONG_PTR)lp + ucb - 1);
|
||||||
|
|
|
@ -38,7 +38,7 @@ HeapCreate(DWORD flOptions,
|
||||||
/* Check if heap is growable and ensure max size is correct */
|
/* Check if heap is growable and ensure max size is correct */
|
||||||
if (dwMaximumSize == 0)
|
if (dwMaximumSize == 0)
|
||||||
Flags |= HEAP_GROWABLE;
|
Flags |= HEAP_GROWABLE;
|
||||||
else if (dwMaximumSize < BaseCachedSysInfo.PageSize &&
|
else if (dwMaximumSize < BaseStaticServerData->SysInfo.PageSize &&
|
||||||
dwInitialSize > dwMaximumSize)
|
dwInitialSize > dwMaximumSize)
|
||||||
{
|
{
|
||||||
/* Max size is non-zero but less than page size which can't be correct.
|
/* Max size is non-zero but less than page size which can't be correct.
|
||||||
|
@ -1204,18 +1204,18 @@ GlobalMemoryStatusEx(LPMEMORYSTATUSEX lpBuffer)
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
/* Calculate memory load */
|
/* Calculate memory load */
|
||||||
lpBuffer->dwMemoryLoad = ((DWORD)(BaseCachedSysInfo.NumberOfPhysicalPages -
|
lpBuffer->dwMemoryLoad = ((DWORD)(BaseStaticServerData->SysInfo.NumberOfPhysicalPages -
|
||||||
PerformanceInfo.AvailablePages) * 100) /
|
PerformanceInfo.AvailablePages) * 100) /
|
||||||
BaseCachedSysInfo.NumberOfPhysicalPages;
|
BaseStaticServerData->SysInfo.NumberOfPhysicalPages;
|
||||||
|
|
||||||
/* Save physical memory */
|
/* Save physical memory */
|
||||||
PhysicalMemory = BaseCachedSysInfo.NumberOfPhysicalPages *
|
PhysicalMemory = BaseStaticServerData->SysInfo.NumberOfPhysicalPages *
|
||||||
BaseCachedSysInfo.PageSize;
|
BaseStaticServerData->SysInfo.PageSize;
|
||||||
lpBuffer->ullTotalPhys = PhysicalMemory;
|
lpBuffer->ullTotalPhys = PhysicalMemory;
|
||||||
|
|
||||||
/* Now save available physical memory */
|
/* Now save available physical memory */
|
||||||
PhysicalMemory = PerformanceInfo.AvailablePages *
|
PhysicalMemory = PerformanceInfo.AvailablePages *
|
||||||
BaseCachedSysInfo.PageSize;
|
BaseStaticServerData->SysInfo.PageSize;
|
||||||
lpBuffer->ullAvailPhys = PhysicalMemory;
|
lpBuffer->ullAvailPhys = PhysicalMemory;
|
||||||
|
|
||||||
/* Query VM and Quota Limits */
|
/* Query VM and Quota Limits */
|
||||||
|
@ -1241,11 +1241,11 @@ GlobalMemoryStatusEx(LPMEMORYSTATUSEX lpBuffer)
|
||||||
lpBuffer->ullAvailPageFile = min(PageFile,
|
lpBuffer->ullAvailPageFile = min(PageFile,
|
||||||
QuotaLimits.PagefileLimit -
|
QuotaLimits.PagefileLimit -
|
||||||
VmCounters.PagefileUsage);
|
VmCounters.PagefileUsage);
|
||||||
lpBuffer->ullAvailPageFile *= BaseCachedSysInfo.PageSize;
|
lpBuffer->ullAvailPageFile *= BaseStaticServerData->SysInfo.PageSize;
|
||||||
|
|
||||||
/* Now calculate the total virtual space */
|
/* Now calculate the total virtual space */
|
||||||
lpBuffer->ullTotalVirtual = (BaseCachedSysInfo.MaximumUserModeAddress -
|
lpBuffer->ullTotalVirtual = (BaseStaticServerData->SysInfo.MaximumUserModeAddress -
|
||||||
BaseCachedSysInfo.MinimumUserModeAddress) + 1;
|
BaseStaticServerData->SysInfo.MinimumUserModeAddress) + 1;
|
||||||
|
|
||||||
/* And finally the avilable virtual space */
|
/* And finally the avilable virtual space */
|
||||||
lpBuffer->ullAvailVirtual = lpBuffer->ullTotalVirtual -
|
lpBuffer->ullAvailVirtual = lpBuffer->ullTotalVirtual -
|
||||||
|
|
Loading…
Reference in a new issue