Excellent! Thanks Randy. Where did you find that??? I searched high and low but found absolutely nothing
------------------
Announcement
Collapse
No announcement yet.
PSAPI.H translation to PSAPI.INC
Collapse
X
-
Guest repliedHere's the translation I found.
Code:'Copyright (c) 1994-1999 Microsoft Corporation ' ' Include file FOR APIs provided by PSAPI.DLL ' 'Author: ' ' Richard Shupak [richards] 06-Jan-1994 ' ' 'Revision History: ' Converted to Powerbasic 5/8/00 ' ' DECLARE FUNCTION EnumProcesses LIB "psapi.dll" ALIAS "EnumProcesses" ( _ BYVAL lpidProcess AS DWORD, _ BYVAL cb AS DWORD, _ cbNeeded AS DWORD) AS LONG DECLARE FUNCTION EnumProcessModules LIB "psapi.dll" ALIAS "EnumProcessModules" ( _ BYVAL hProcess AS LONG, _ BYVAL lphModule AS LONG, _ BYVAL cb AS DWORD, _ lpcbNeeded AS DWORD) AS LONG DECLARE FUNCTION GetModuleBaseName LIB "psapi.dll" ALIAS "GetModuleBaseNameA" ( _ BYVAL hProcess AS LONG, _ BYVAL hModule AS LONG, _ lpBaseName AS ASCIIZ, _ BYVAL nSize AS DWORD) AS DWORD DECLARE FUNCTION GetModuleFileNameEx LIB "psapi.dll" ALIAS "GetModuleFileNameExA" ( _ BYVAL hProcess AS LONG, _ BYVAL hModule AS LONG, _ lpFilename AS ASCIIZ, _ BYVAL nSize AS DWORD) AS DWORD TYPE MODULEINFO lpBaseOfDll AS LONG SizeOfImage AS LONG EntryPoint AS LONG END TYPE 'TYPE MODULEINFO ' lpBaseOfDll AS DWORD ' SizeOfImage AS DWORD ' EntryPoint AS DWORD 'END TYPE DECLARE FUNCTION GetModuleInformation LIB "psapi.dll" ALIAS "GetModuleInformation" ( _ BYVAL hProcess AS LONG, _ BYVAL hModule AS LONG, _ lpmodinfo AS MODULEINFO, _ BYVAL cb AS DWORD) AS DWORD DECLARE FUNCTION GetMappedFileName LIB "psapi.dll" ALIAS "GetMappedFileName" ( _ BYVAL hProcess AS LONG, _ BYVAL lpv AS DWORD, _ lpFilename AS ASCIIZ, _ BYVAL nSize AS DWORD) AS DWORD '// Structure FOR GetProcessMemoryInfo() TYPE PROCESS_MEMORY_COUNTERS cb AS DWORD PageFaultCount AS DWORD PeakWorkingSetSize AS DWORD WorkingSetSize AS DWORD QuotaPeakPagedPoolUsage AS DWORD QuotaPagedPoolUsage AS DWORD QuotaPeakNonPagedPoolUsage AS DWORD QuotaNonPagedPoolUsage AS DWORD PagefileUsage AS DWORD PeakPagefileUsage AS DWORD END TYPE DECLARE FUNCTION GetProcessMemoryInfo LIB "psapi.dll" ALIAS "GetProcessMemoryInfo" ( _ BYVAL Process AS LONG, _ ppsmemCounters AS PROCESS_MEMORY_COUNTERS, _ BYVAL cb AS DWORD) AS LONG 'do the rest of these later 'BOOL 'WINAPI 'EmptyWorkingSet( ' HANDLE hProcess ' ); ' ' 'BOOL 'WINAPI 'QueryWorkingSet( ' HANDLE hProcess, ' PVOID pv, ' DWORD cb ' ); ' 'BOOL 'WINAPI 'InitializeProcessForWsWatch( ' HANDLE hProcess ' ); ' ' 'typedef struct _PSAPI_WS_WATCH_INFORMATION { ' LPVOID FaultingPc; ' LPVOID FaultingVa; '} PSAPI_WS_WATCH_INFORMATION, *PPSAPI_WS_WATCH_INFORMATION; ' 'BOOL 'WINAPI 'GetWsChanges( ' HANDLE hProcess, ' PPSAPI_WS_WATCH_INFORMATION lpWatchInfo, ' DWORD cb ' ); ' 'DWORD 'WINAPI 'GetMappedFileNameW( ' HANDLE hProcess, ' LPVOID lpv, ' LPWSTR lpFilename, ' DWORD nSize ' ); ' ' 'BOOL 'WINAPI 'EnumDeviceDrivers( ' LPVOID *lpImageBase, ' DWORD cb, ' LPDWORD lpcbNeeded ' ); ' ' 'DWORD 'WINAPI 'GetDeviceDriverBaseNameA( ' LPVOID ImageBase, ' LPSTR lpBaseName, ' DWORD nSize ' ); ' 'DWORD 'WINAPI 'GetDeviceDriverBaseNameW( ' LPVOID ImageBase, ' LPWSTR lpBaseName, ' DWORD nSize ' ); ' '#ifdef UNICODE '#define GetDeviceDriverBaseName GetDeviceDriverBaseNameW '#ELSE '#define GetDeviceDriverBaseName GetDeviceDriverBaseNameA '#ENDIF // !UNICODE ' ' 'DWORD 'WINAPI 'GetDeviceDriverFileNameA( ' LPVOID ImageBase, ' LPSTR lpFilename, ' DWORD nSize ' ); ' 'DWORD 'WINAPI 'GetDeviceDriverFileNameW( ' LPVOID ImageBase, ' LPWSTR lpFilename, ' DWORD nSize ' ); ' '#ifdef UNICODE '#define GetDeviceDriverFileName GetDeviceDriverFileNameW '#ELSE '#define GetDeviceDriverFileName GetDeviceDriverFileNameA '#ENDIF // !UNICODE '
------------------
R.
* UUB tags added by Administrator
Leave a comment:
-
PSAPI.H translation to PSAPI.INC
Has anybody translated PSAPI.H to PB? The Hdr2inc utility wasnt able to get very far with it, and neither was I but there's not much to it. If anybody could post a PB-compatible translation I would be extremely grateful
The psapi.h file below is from the freeware LCC-Win32 so I think its ok to post here, but if not, Lance feel free to modify the post
Code:// PSAPI.H #ifndef __psapi_h__ #define __psapi_h__ BOOL WINAPI EnumProcesses(DWORD *,DWORD,DWORD *); BOOL WINAPI EnumProcessModules(HANDLE,HMODULE *,DWORD,LPDWORD); DWORD WINAPI GetModuleBaseNameA(HANDLE,HMODULE,LPSTR,DWORD); DWORD WINAPI GetModuleBaseNameW(HANDLE,HMODULE,LPWSTR,DWORD); #ifdef UNICODE #define GetModuleBaseName GetModuleBaseNameW #define GetModuleFileNameEx GetModuleFileNameExW #define GetMappedFilenameEx GetMappedFilenameExW #define GetDeviceDriverBaseName GetDeviceDriverBaseNameW #define GetDeviceDriverFileName GetDeviceDriverFileNameW #else #define GetModuleBaseName GetModuleBaseNameA #define GetModuleFileNameEx GetModuleFileNameExA #define GetMappedFilenameEx GetMappedFilenameExA #define GetDeviceDriverBaseName GetDeviceDriverBaseNameA #define GetDeviceDriverFileName GetDeviceDriverFileNameA #endif DWORD WINAPI GetModuleFileNameExA(HANDLE,HMODULE,LPSTR,DWORD); DWORD WINAPI GetModuleFileNameExW(HANDLE,HMODULE,LPWSTR,DWORD); typedef struct _MODULEINFO { LPVOID lpBaseOfDll; DWORD SizeOfImage; LPVOID EntryPoint; } MODULEINFO,*LPMODULEINFO; BOOL WINAPI GetModuleInformation(HANDLE,HMODULE,LPMODULEINFO,DWORD); BOOL WINAPI EmptyWorkingSet(HANDLE); BOOL WINAPI QueryWorkingSet(HANDLE,PVOID,DWORD); BOOL WINAPI InitializeProcessForWsWatch(HANDLE); typedef struct _PSAPI_WS_WATCH_INFORMATION { LPVOID FaultingPc; LPVOID FaultingVa;} PSAPI_WS_WATCH_INFORMATION,*PPSAPI_WS_WATCH_INFORMATION; BOOL WINAPI GetWsChanges(HANDLE,PPSAPI_WS_WATCH_INFORMATION,DWORD); DWORD WINAPI GetMappedFileNameW(HANDLE,LPVOID,LPWSTR,DWORD); DWORD WINAPI GetMappedFileNameA(HANDLE,LPVOID,LPSTR,DWORD); BOOL WINAPI EnumDeviceDrivers(LPVOID *,DWORD ,LPDWORD); DWORD WINAPI GetDeviceDriverBaseNameA(LPVOID,LPSTR,DWORD); DWORD WINAPI GetDeviceDriverBaseNameW(LPVOID,LPWSTR,DWORD); DWORD WINAPI GetDeviceDriverFileNameA(LPVOID,LPSTR,DWORD); DWORD WINAPI GetDeviceDriverFileNameW(LPVOID,LPWSTR,DWORD); typedef struct _PROCESS_MEMORY_COUNTERS { DWORD cb; DWORD PageFaultCount; SIZE_T PeakWorkingSetSize; SIZE_T WorkingSetSize; SIZE_T QuotaPeakPagedPoolUsage; SIZE_T QuotaPagedPoolUsage; SIZE_T QuotaPeakNonPagedPoolUsage; SIZE_T QuotaNonPagedPoolUsage; SIZE_T PagefileUsage; SIZE_T PeakPagefileUsage; } PROCESS_MEMORY_COUNTERS; typedef PROCESS_MEMORY_COUNTERS *PPROCESS_MEMORY_COUNTERS; BOOL WINAPI GetProcessMemoryInfo(HANDLE,PPROCESS_MEMORY_COUNTERS,DWORD); #endif
Wayne
------------------
Tags: None
Leave a comment: