Click here to Skip to main content
15,887,596 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,

I have been writing some Pinvoke code for lower level WinAPI Access Control functions. I have a pointer to Privileges associated with my access token from the TOKEN_ACCESS_INFORMATION and I am looking at the privileges. I have working code but decided to refactor part of it to a generic method that given a pointer to a structure with a count property could retrieve the array of items associated with the count. The problem is that the following code inside the generic method ( first line of code ) that is passed the pointer does not return a consistent result. From within the method that obtained the pointer it is as expected.

uint uiPrivilegeCount = (uint)Marshal.PtrToStructure(privilegePointer, typeof(uint));

Many thanks

Tony
Posted
Updated 15-May-14 10:42am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900