JScript 71 Posted July 24, 2010 Hi,Could anyone help me translate the code below to AutoItv3?Here is the code for creating the page file in C++:expandcollapse popupstatic BOOL EnablePrivilege() { HANDLE hToken; TOKEN_PRIVILEGES tp; // Get a token for this process. OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken); // Get the LUID for the shutdown privilege. LookupPrivilegeValue(NULL, SE_CREATE_PAGEFILE_NAME, &tp.Privileges[0].Luid); tp.PrivilegeCount = 1; tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED; AdjustTokenPrivileges(hToken, FALSE, &tp, 0, NULL, 0); DWORD ret = GetLastError(); return ret == ERROR_SUCCESS; } ... HMODULE hDLL = LoadLibrary("NTDLL.dll"); NtCreatePagingFile pf = (NtCreatePagingFile)GetProcAddress(hDLL, "NtCreatePagingFile"); if (!EnablePrivilege()) { return 1; } WCHAR pagefile[MAX_PATH]; TCHAR Disk[25]; TCHAR Dir = FileName[2]; FileName[2] = 0; QueryDosDevice(FileName, Disk, 25); FileName[2]=Dir; StringCbPrintfW(pagefile, MAX_PATH, L"%S\\%S",Disk, &FileName[3]); int len = lstrlenW(pagefile); ULARGE_INTEGER liMinSize; ULARGE_INTEGER liMaxSize; liMinSize.QuadPart = MinSize; liMaxSize.QuadPart = MaxSize; liMinSize.QuadPart *= (1024 * 1024); liMaxSize.QuadPart *= (1024 * 1024); UNICODE_STRING us; us.Buffer = pagefile; us.Length = (USHORT)(len*sizeof(WCHAR)); us.MaximumLength = us.Length+sizeof(WCHAR); DWORD ret = pf(&us, &liMinSize, &liMaxSize, 0);Source: Enabling page file on the LiveXP after boot http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!)Somewhere Out ThereJames IngramDownload Dropbox - Simplify your life!Your virtual HD wherever you go, anywhere! Share this post Link to post Share on other sites