Simple API but I can't get it to work (GetAppliedGPOList)
If one of you API gurus could look at this module and tell me what I am doing wrong I would appreciate it. This should be pretty straight forward and it's executing without errors but nothing is being returned.
(I purposely put the 'stop' in there so I could evaluate the returned results)
VB Code:
Module Module1
Const GPO_LIST_FLAG_MACHINE = &H1
Private Structure GROUP_POLICY_OBJECT
Public dwOptions As Integer
Public dwVersion As Integer
Public lpDSPath As String
<VBFixedString(50)> Public lpDisplayName As String
Public szGPOName As Byte()
Public GPOLink As Integer
Public lparam As Integer
Public pNext As IntPtr
Public pprev As IntPtr
Public lpExtensions As String
Public lparam2 As Integer
Public lpLink As String
End Structure
Sub Main()
Dim obj As IntPtr = Nothing
Dim retval As Boolean = GetAppliedGPOList(GPO_LIST_FLAG_MACHINE, Nothing, Nothing, Nothing, obj)
Stop
End Sub
<System.Runtime.InteropServices.DllImport("userenv.dll", EntryPoint:="GetAppliedGPOListA")> _
Function GetAppliedGPOList(ByVal dwflags As Integer, ByVal pMachineName As String, ByVal pSidUser As IntPtr, ByVal pGuidExtension As IntPtr, ByRef ppGPOList As IntPtr) As Boolean
End Function
End Module
Re: Simple API but I can't get it to work (GetAppliedGPOList)
i don't know, but problems with api calls in .net are almost always declaring the wrong data type in a declaration, because they aren't the same as in vb6 or c++