Function Pointer? [modified]
-
If we declare a function pointer as typedef void (*myPtr)(void); myptr NewPtr; This means that NewPtr is a function pointer of type myptr, where myptr is inturn a function pointer to a function which returns void and takes no function parameters.. then what does the below piece of code mean? Can somebody please interpret this piece of code for me? typedef NTSTATUS (NTAPI *pfnNtQueryInformationProcess)( IN HANDLE ProcessHandle, IN PROCESSINFOCLASS ProcessInformationClass, OUT PVOID ProcessInformation, IN ULONG ProcessInformationLength, OUT PULONG ReturnLength OPTIONAL ); pfnNtQueryInformationProcess gNtQueryInformationProcess; Thanx -- modified at 9:07 Thursday 4th October, 2007
-
If we declare a function pointer as typedef void (*myPtr)(void); myptr NewPtr; This means that NewPtr is a function pointer of type myptr, where myptr is inturn a function pointer to a function which returns void and takes no function parameters.. then what does the below piece of code mean? Can somebody please interpret this piece of code for me? typedef NTSTATUS (NTAPI *pfnNtQueryInformationProcess)( IN HANDLE ProcessHandle, IN PROCESSINFOCLASS ProcessInformationClass, OUT PVOID ProcessInformation, IN ULONG ProcessInformationLength, OUT PULONG ReturnLength OPTIONAL ); pfnNtQueryInformationProcess gNtQueryInformationProcess; Thanx -- modified at 9:07 Thursday 4th October, 2007
exactly the same as your code, at the difference that the pfnNtQueryInformationProcess is a typedef to a function pointer to a function which returns a NTSTATUS and gets as parameters a HANDLE, a PROCESSINFOCLASS, a PVOID, an ULONG, and a PULONG... then you declare a variable gNtQueryInformationProcess of that type so defined... what don't you understand in this ?
[VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]
-
If we declare a function pointer as typedef void (*myPtr)(void); myptr NewPtr; This means that NewPtr is a function pointer of type myptr, where myptr is inturn a function pointer to a function which returns void and takes no function parameters.. then what does the below piece of code mean? Can somebody please interpret this piece of code for me? typedef NTSTATUS (NTAPI *pfnNtQueryInformationProcess)( IN HANDLE ProcessHandle, IN PROCESSINFOCLASS ProcessInformationClass, OUT PVOID ProcessInformation, IN ULONG ProcessInformationLength, OUT PULONG ReturnLength OPTIONAL ); pfnNtQueryInformationProcess gNtQueryInformationProcess; Thanx -- modified at 9:07 Thursday 4th October, 2007
pfnNtQueryInformationProcess
is a function pointer to a function that returnsNTSTATUS
, has anNTAPI
calling convention, and takes five arguments.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
-
exactly the same as your code, at the difference that the pfnNtQueryInformationProcess is a typedef to a function pointer to a function which returns a NTSTATUS and gets as parameters a HANDLE, a PROCESSINFOCLASS, a PVOID, an ULONG, and a PULONG... then you declare a variable gNtQueryInformationProcess of that type so defined... what don't you understand in this ?
[VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]
Then it should have been declared as typedef NTSTATUS (*pfnNtQueryInformationProcess)( IN HANDLE ProcessHandle, IN PROCESSINFOCLASS ProcessInformationClass, OUT PVOID ProcessInformation, IN ULONG ProcessInformationLength, OUT PULONG ReturnLength OPTIONAL ); pfnNtQueryInformationProcess gNtQueryInformationProcess; What is this NTAPI in between? What is its signifance? Thanx
-
Then it should have been declared as typedef NTSTATUS (*pfnNtQueryInformationProcess)( IN HANDLE ProcessHandle, IN PROCESSINFOCLASS ProcessInformationClass, OUT PVOID ProcessInformation, IN ULONG ProcessInformationLength, OUT PULONG ReturnLength OPTIONAL ); pfnNtQueryInformationProcess gNtQueryInformationProcess; What is this NTAPI in between? What is its signifance? Thanx
kiranin wrote:
What is this NTAPI in between
it is the calling convention... see how it's defined if that interrest you, but it's probably one of these : __stdcall, __fastcall, __cdecl, __thiscall...
[VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]
-
kiranin wrote:
What is this NTAPI in between
it is the calling convention... see how it's defined if that interrest you, but it's probably one of these : __stdcall, __fastcall, __cdecl, __thiscall...
[VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]