En qué OS lo estas ejecutando? Probá declarando la función como Shared,
y con el tipo de retorno Int32. Qué valor le pasas a "Flags"? Y por si
no lo viste por ahí:
The calling process must enable the SE_INCREASE_QUOTA_NAME privilege.
Setting the /MaximumFileCacheSize/ parameter to a very low value can
adversely affect system performance.
To compile an application that uses this function, define _WIN32_WINNT
as 0x0502 or later.
The FILE_CACHE constants will be defined in the Windows header files
starting with the Windows SDK for Windows Server 2008. If you are using
header files from an earlier version of the SDK, add the following
definitions to your code.
#ifndef FILE_CACHE_FLAGS_DEFINED
#define FILE_CACHE_MAX_HARD_ENABLE 0x00000001
#define FILE_CACHE_MAX_HARD_DISABLE 0x00000002
#define FILE_CACHE_MIN_HARD_ENABLE 0x00000004
#define FILE_CACHE_MIN_HARD_DISABLE 0x00000008
#endif // FILE_CACHE_FLAGS_DEFINED
Requirements
Minimum supported client
Windows Vista, Windows XP Professional x64 Edition
Minimum supported server
Windows Server 2008, Windows Server 2003 with SP1
Saludosss
El 19/04/2011 5:20 p, Pablo A. Allois escribió:
Buenas tardes gente,
Estoy renegando haciendo una llamada a una API del kernel.
BOOL WINAPI SetSystemFileCacheSize( __in SIZE_T
MinimumFileCacheSize, __in SIZE_T MaximumFileCacheSize, __in DWORD
Flags);
Ya intente pasando los parametros SIZE_T como int32, int64 e intptr y
tengo diferentes errores:
"Access denied" à aunque sea admin de la maquina
"Parameter incorrect"
"Arithmetic result exceeded 32 bits" à aunque todos los tipos de los
parametros sea int64
Alguien se le ocurre como llamar correctamente este método.
' BOOL WINAPI SetSystemFileCacheSize( __in SIZE_T
MinimumFileCacheSize, __in SIZE_T MaximumFileCacheSize, __in DWORD
Flags );
<System.Runtime.InteropServices.DllImport("kernel32.dll",
SetLastError:=True)> _
Public Function SetSystemFileCacheSize(ByVal MinimumFileCacheSize As
Int32, ByVal MaximumFileCacheSize As Int32, ByVal Flags As Int32) As
System.Boolean
EndFunction
Gracias.