All you have to do is change your ad like this:
[DllImport("KERNEL32.DLL", EntryPoint = "SetProcessWorkingSetSize",
SetLastError = true, CallingConvention = CallingConvention.StdCall)]
internal static extern bool SetProcessWorkingSetSize(IntPtr pProcess,
long dwMinimumWorkingSetSize, long dwMaximumWorkingSetSize);
The reason is that the function definitionSetProcessWorkingSetSize :
BOOL WINAPI SetProcessWorkingSetSize(
_In_ HANDLE hProcess,
_In_ SIZE_T dwMinimumWorkingSetSize,
_In_ SIZE_T dwMaximumWorkingSetSize
);
Note that it does not use DWORD(as a 32-bit integer), but SIZE_Twhich is defined as :
The maximum number of bytes that the pointer points to. Use for count, which should cover the entire range of the pointer. This type is declared in BaseTsd.h as follows:
typedef ULONG_PTR SIZE_T;
, 64- , , long 64- . , MSDN " 64- Visual ++:
size_t, time_t ptrdiff_t - 64- 64- Windows.
, ( PITA). , EntryPoint DllImportAttribute ( ), :
[DllImport("KERNEL32.DLL", EntryPoint = "SetProcessWorkingSetSize",
SetLastError = true, CallingConvention = CallingConvention.StdCall)]
internal static extern bool SetProcessWorkingSetSize32(IntPtr pProcess,
int dwMinimumWorkingSetSize, int dwMaximumWorkingSetSize);
[DllImport("KERNEL32.DLL", EntryPoint = "SetProcessWorkingSetSize",
SetLastError = true, CallingConvention = CallingConvention.StdCall)]
internal static extern bool SetProcessWorkingSetSize64(IntPtr pProcess,
long dwMinimumWorkingSetSize, long dwMaximumWorkingSetSize);
. , , - . . , .
Is64BitProcess Environment , . Is64BitOperatingSystem. , 32- 64- , , ; , 64- .