1 /* $Id: init.c 13449 2005-02-06 21:55:07Z ea $
5 * ReactOS Operating System
7 * --------------------------------------------------------------------
9 * This software is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License as
11 * published by the Free Software Foundation; either version 2 of the
12 * License, or (at your option) any later version.
14 * This software is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this software; see the file COPYING.LIB. If not, write
21 * to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge,
24 * --------------------------------------------------------------------
27 #include <rosrtl/string.h>
33 static NTSTATUS STDCALL
34 SmpPagingFilesQueryRoutine(PWSTR ValueName
,
41 UNICODE_STRING FileName
;
42 LARGE_INTEGER InitialSize
;
43 LARGE_INTEGER MaximumSize
;
47 DPRINT("ValueName '%S' Type %lu Length %lu\n", ValueName
, ValueType
, ValueLength
);
48 DPRINT("ValueData '%S'\n", (PWSTR
)ValueData
);
50 if (ValueType
!= REG_SZ
)
52 return(STATUS_SUCCESS
);
56 * Format: "<path>[ <initial_size>[ <maximum_size>]]"
58 if ((p
= wcschr(ValueData
, ' ')) != NULL
)
61 InitialSize
.QuadPart
= wcstoul(p
+ 1, &p
, 0) * 256 * 4096;
64 MaximumSize
.QuadPart
= wcstoul(p
+ 1, NULL
, 0) * 256 * 4096;
67 MaximumSize
= InitialSize
;
71 InitialSize
.QuadPart
= 50 * 4096;
72 MaximumSize
.QuadPart
= 80 * 4096;
75 if (!RtlDosPathNameToNtPathName_U ((LPWSTR
)ValueData
,
80 return (STATUS_SUCCESS
);
83 DPRINT("SMSS: Created paging file %wZ with size %dKB\n",
84 &FileName
, InitialSize
.QuadPart
/ 1024);
85 Status
= NtCreatePagingFile(&FileName
,
90 RtlFreeUnicodeString(&FileName
);
92 return(STATUS_SUCCESS
);
97 SmCreatePagingFiles(VOID
)
99 RTL_QUERY_REGISTRY_TABLE QueryTable
[2];
102 DPRINT("SM: creating system paging files\n");
104 * Disable paging file on MiniNT/Live CD.
106 if (RtlCheckRegistryKey(RTL_REGISTRY_CONTROL
, L
"MiniNT") == STATUS_SUCCESS
)
108 return STATUS_SUCCESS
;
111 RtlZeroMemory(&QueryTable
,
114 QueryTable
[0].Name
= L
"PagingFiles";
115 QueryTable
[0].QueryRoutine
= SmpPagingFilesQueryRoutine
;
117 Status
= RtlQueryRegistryValues(RTL_REGISTRY_CONTROL
,
118 L
"\\Session Manager\\Memory Management",