Results 1 to 2 of 2

Thread: Simple API but I can't get it to work (GetAppliedGPOList)

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2001
    Location
    Houston, TX
    Posts
    342

    Question 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:
    1. Module Module1
    2.     Const GPO_LIST_FLAG_MACHINE = &H1
    3.  
    4.     Private Structure GROUP_POLICY_OBJECT
    5.         Public dwOptions As Integer
    6.         Public dwVersion As Integer
    7.         Public lpDSPath As String
    8.         <VBFixedString(50)> Public lpDisplayName As String
    9.         Public szGPOName As Byte()
    10.         Public GPOLink As Integer
    11.         Public lparam As Integer
    12.         Public pNext As IntPtr
    13.         Public pprev As IntPtr
    14.         Public lpExtensions As String
    15.         Public lparam2 As Integer
    16.         Public lpLink As String
    17.     End Structure
    18.  
    19.     Sub Main()
    20.  
    21.         Dim obj As IntPtr = Nothing
    22.         Dim retval As Boolean = GetAppliedGPOList(GPO_LIST_FLAG_MACHINE, Nothing, Nothing, Nothing, obj)
    23.  
    24.         Stop
    25.  
    26.     End Sub
    27.  
    28.  
    29.     <System.Runtime.InteropServices.DllImport("userenv.dll", EntryPoint:="GetAppliedGPOListA")> _
    30.     Function GetAppliedGPOList(ByVal dwflags As Integer, ByVal pMachineName As String, ByVal pSidUser As IntPtr, ByVal pGuidExtension As IntPtr, ByRef ppGPOList As IntPtr) As Boolean
    31.     End Function
    32.  
    33. End Module
    Last edited by MagellanTX; Dec 9th, 2007 at 10:33 PM.

  2. #2
    coder. Lord Orwell's Avatar
    Join Date
    Feb 2001
    Location
    Elberfeld, IN
    Posts
    7,628

    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++
    My light show youtube page (it's made the news) www.youtube.com/@lightsofelberfeld
    Contact me on the socials www.facebook.com/lordorwell

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width