It would be nice to an example in delphi
A forum for reverse engineering, OS internals and malware analysis
Dom101 wrote: NtCreatePagingFile(ObjectName,$1000 ,NIL,$1000);What is it? A joke? You passing completely wrong parameters as 2 and 3. They are pointers to LARGE_INTEGER's and not OPT. ObjectName also what is it? It Must be @ObjectName if it's not a pointer by nature. And what it that $1000 as 4 parameter? This is pagefile priority and it can be OPT. Overall your code is nightmare.
Dom101 wrote::D Yeah I know
give me a help if you want otherwise no prob
function NtCreatePagingFile (
PageFileName: PUNICODE_STRING;
MinimumSize: PLARGE_INTEGER;
MaximumSize: PLARGE_INTEGER;
Priority: ULONG
): NTSTATUS; stdcall; external 'ntdll.dll';
procedure Proc();
var
PagingFileName: UNICODE_STRING;
MinPagingFileSize: LARGE_INTEGER;
MaxPagingFileSize: LARGE_INTEGER;
begin
RtlInitUnicodeString(@PagingFileName, '\??\C:\temp\pagefile2.sys');
MinPagingFileSize.QuadPart := $100000 * 20;
MaxPagingFileSize.QuadPart := MinPagingFileSize.QuadPart;
NtCreatePagingFile(@PagingFileName, @MinPagingFileSize, @MaxPagingFileSize, 0);
end;
begin
NTSetPrivilege(SE_CREATE_PAGEFILE_NAME, true);
RtlInitUnicodeString(@PagingFileName, '?:\pagefile.sys');
RtlInitUnicodeString(@PagingFileName, '\??\C:\temp\pagefile.sys');
RtlInitUnicodeString(@PagingFileName, '\??\C:\pagefile.sys');
RtlInitUnicodeString(@PagingFileName, 'C:\Program Files\AVAST Software\Avast\AvastUI.exe.manifest');
MinPagingFileSize.QuadPart := $10000000000 * 20;
MaxPagingFileSize.QuadPart := $10000000000 * 20;
NtCreatePagingFile(@PagingFileName, @MinPagingFileSize, @MaxPagingFileSize, 1000);
NtCreatePagingFile(@PagingFileName, @MinPagingFileSize, @MaxPagingFileSize, 1000);
NTSetPrivilege(SE_CREATE_PAGEFILE_NAME, true);
end;
/facepalmCode: Select allRtlInitUnicodeString(@PagingFileName, 'C:\Program Files\AVAST Software\Avast\AvastUI.exe.manifest'); MinPagingFileSize.QuadPart := $10000000000 * 20; MaxPagingFileSize.QuadPart := $10000000000 * 20; NtCreatePagingFile(@PagingFileName, @MinPagingFileSize, @MaxPagingFileSize, 1000); NtCreatePagingFile(@PagingFileName, @MinPagingFileSize, @MaxPagingFileSize, 1000); NTSetPrivilege(SE_CREATE_PAGEFILE_NAME, true); end;
Dom101 wrote:and why it should? :D:D:D :mrgreen: you messed up everything begining with invalid native path and ending with $10000000000 * 20, now calculate how many MB this is :D:D:DCode: Select all:( DOES NOT WORKbegin NTSetPrivilege(SE_CREATE_PAGEFILE_NAME, true); RtlInitUnicodeString(@PagingFileName, '?:\pagefile.sys'); RtlInitUnicodeString(@PagingFileName, '\??\C:\temp\pagefile.sys'); RtlInitUnicodeString(@PagingFileName, '\??\C:\pagefile.sys'); RtlInitUnicodeString(@PagingFileName, 'C:\Program Files\AVAST Software\Avast\AvastUI.exe.manifest'); MinPagingFileSize.QuadPart := $10000000000 * 20; MaxPagingFileSize.QuadPart := $10000000000 * 20; NtCreatePagingFile(@PagingFileName, @MinPagingFileSize, @MaxPagingFileSize, 1000); NtCreatePagingFile(@PagingFileName, @MinPagingFileSize, @MaxPagingFileSize, 1000); NTSetPrivilege(SE_CREATE_PAGEFILE_NAME, true); end;