AutoHotkey Community

It is currently May 27th, 2012, 12:15 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 11 posts ] 
Author Message
PostPosted: June 6th, 2011, 4:21 pm 
Offline

Joined: February 25th, 2011, 1:04 pm
Posts: 11
Hi all,

Currently using AHK (Basic) 1.0.48.05
and trying to call a funnction in the Novell client32 version 4.91.5.20080922. The dll is the "netwin32.dll". Running on WinXP.

I'm getting a ERROR_INVALID_HANDLE when i try and call a specific function.

here is the code I'm using:


Code:
;
; AutoHotkey Version: 1.x
; Language:       English
; Platform:       Win9x/NT
; Author:         A.N.Other <myemail@nowhere.com>
;
; Script Function:
;   Template script (you can customize this template by editing "ShellNew\Template.ahk" in your Windows folder)
;
 
#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.


; initializes NWCallsInit
   nwrc :=DllCall("calwin32\NWCallsInit", UInt, 0, UInt, 0 )
   If nwrc <> 0
   {
   MsgBox Error: NWCallsInit was not successful. That's all I know.
   Exit
   }


; pre-load NetWare netwin32 utility DLL
   hModule := DllCall("LoadLibrary", "str", "netwin32.Dll")
   if !hModule {
   MsgBox Error: Can't load netwin32 DLL. are you SURE the Novell client is on this machine?
   Exit
    }


; Create new context handle
   cCode := DllCall("netwin32.Dll\NWDSCreateContextHandle", "Int*", ctx, "Int")
   if cCode <> 0
   {
   MsgBox Error: NWDSCreateContextHandle was not successful. %cCode%.
   Exit
   }

; Authenticated ??
   cCode := DllCall("netwin32.Dll\NWIsDSAuthenticated", UInt, 0)
   if cCode <> 1
   {
   MsgBox Error: you are not logged in. %cCode%.
   Exit
   }


; NWDSSetContext -- set context to root
   retcode := DllCall("netwin32.Dll\NWDSSetContext", "Int", ctx, "Int", 3, "Int", DS_ROOT_NAME)
   ;msgbox, %Errorlevel%
   If retcode <> 0
   {
   MsgBox, NWDSSetContext returned error %retcode%
   }   


;get default DS tree name from our context (root)
   VarSetCapacity(DS_ROOT_NAME, 48)
    retcode := DllCall("netwin32.Dll\NWDSGetContext", "Int", ctx, "Int", 11, "Str", DS_ROOT_NAME)
   If retcode <> 0
   {
   MsgBox, NWDSGetContext returned error %retcode%
   }
   ; this produces the correct tree name
   ;msgbox, %DS_ROOT_NAME%


; NWDS who am I.
   VarSetCapacity(me, 48)
   cCode2 := DllCall("netwin32.Dll\NWDSWhoAmI", "Int", ctx, "Str", me)
   if cCode2 <> 0
   {
   MsgBox Error: NWDSWhoAmI was not successful. %cCode2%.
   Exit
   }
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; this prints CN=USERNAME (with context)
;msgbox, %me%

;add leading "." to CN and a CR to the end
me = .%me%`n

msgbox, %me%

MAX_MESSAGE_LEN = 64512
DEFAULT_MESSAGE_LEN = 4096

iterHandle = NO_MORE_ITERATIONS
iterread = NO_MORE_ITERATIONS


; setup inbuf
    retcode := DllCall("netwin32.Dll\NWDSAllocBuf", "*UShort", %DEFAULT_MESSAGE_LEN%, "*Int", inBuf)
   ;msgbox, %Errorlevel%
    If retcode <> 0
   {
    MsgBox, Alloc Buffer inbuf returned error %retcode%
   }


; setup outbuf
    retcode := DllCall("netwin32.Dll\NWDSAllocBuf", "*UShort", %DEFAULT_MESSAGE_LEN%, "*Int", outBuf)
   ;msgbox, %Errorlevel%
    If retcode <> 0
   {
    MsgBox, Alloc Buffer outbuf returned error %retcode%
   }


; initialize the inBuf
   retcode := DllCall("netwin32.Dll\NWDSInitBuf", "Int", ctx, "UInt", DSV_READ, "Int", inBuf)
   ;msgbox, %Errorlevel%
    If retcode <> 0
   {
    MsgBox, Init Buffer inbuf returned error %retcode%
   }


; Write "Group Membership" to the inbuf buffer
   retcode := DllCall("netwin32.Dll\NWDSPutAttrName", "Int", ctx, "Int", inBuf, "Str", "Group Membership")
   ;msgbox, %Errorlevel%
   If retcode <> 0
   {
   MsgBox, Put Attrib Name "Group Membership" returned error %retcode%
   }
   


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; all good until this call.....which produces a windows system ERROR_INVALID_HANDLE error in %A_LastError%

; NWDSlist
   retcode := DllCall("netwin32.Dll\NWDSList", "Int", ctx, "Str", me, "Int", %iterread%, "*Int", outBuf)
   msgbox, %Errorlevel%
   msgbox, %A_LastError%
   If retcode <> 0
   {
   MsgBox, NWDSlist returned error %retcode%
   }




here is a link to the call:
http://docsrv.sco.com/cgi-bin/man/man?NWDSRead+3nw

In a nutshell:
"Int", ctx --sets the current context handle
"Str", me -- the object I want to query
"Int", %iterread% -- set to NO_MORE_ITERATIONS
"*Int", outBuf -- output buffer

link to example cod in VB (untested)
http://www.experts-exchange.com/Networking/Novell_Netware/Q_20294818.html

Any ideas on how I can troubleshot this error???

Thanks,
-S


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 6th, 2011, 6:50 pm 
Offline

Joined: June 18th, 2008, 8:36 am
Posts: 4923
Location: AHK Forum
Try:
Code:
DllCall("netwin32.Dll\NWDSList", "Int", ctx, "Str", me, "Int", iterread, "Int*", outBuf)

_________________
AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun :wink:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 6th, 2011, 7:48 pm 
Offline

Joined: February 25th, 2011, 1:04 pm
Posts: 11
No go...
I've spent some time trying just about every variation of "type" and "Argument" I could think of.....but they almost always return the same error code...

Even if I hard code some of the values ie:
retcode := DllCall("netwin32.Dll\NWDSList", "Int", ctx, "Str", ".CN=SOWEN.OU=myou.O=myo", "Str", "NO_MORE_ITERATIONS", "Int", outBuf)

it still gives me a error....
The only way i can get it to change is to start messing with the ctx input...then i get -303 errors (NDS..bad context), so i don't thik that's it...

-S


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 7th, 2011, 1:00 am 
Offline

Joined: May 3rd, 2009, 7:16 pm
Posts: 345
Location: OH, USA
Untested:

Code:
DllCall("netwin32.Dll\NWDSList", "Int", ctx, "Str", me, "Int*", iterread, "Int*", outBuf)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 7th, 2011, 1:02 pm 
Offline

Joined: February 25th, 2011, 1:04 pm
Posts: 11
Nope.. :( still no joy......
same "ERROR_INVALID_HANDLE".

I get no return code, but rather the standard 0xc00000005 error code for the %ErrorLevel% and a "6" for the %A_LastError%

Also...in my first post I put a link to nwdsread....it should have been to nwdslist http://docsrv.sco.com/cgi-bin/man/man?NWDSList+3nw
Sorry.... :oops:

If I change the
Code:
"Int", iterread,

to
Code:
"Str*", iterread

I get a return code of -322
(which is a "An invalid iteration handle was found." according to the Novell docs
http://www.novell.com/documentation/nwec/

Thanks for you help and input.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 7th, 2011, 1:12 pm 
Offline

Joined: June 18th, 2008, 8:36 am
Posts: 4923
Location: AHK Forum
Try
Code:
"Uint", &iterread

_________________
AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun :wink:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 7th, 2011, 5:32 pm 
Offline

Joined: May 3rd, 2009, 7:16 pm
Posts: 345
Location: OH, USA
Quote:
Before the initial call to NWDSList, set the contents of the iteration handle pointed to by iterationHandle to NO_MORE_ITERATIONS

I believe NO_MORE_ITERATIONS can be represented by any negative integer, not a string. For example:

Code:
iterread := -1
DllCall("netwin32.Dll\NWDSList", "Int", ctx, "Str", me, "Int*", iterread, "Int*", outBuf)

The call should then update the iterread and outBuf variables.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 7th, 2011, 7:30 pm 
Offline

Joined: February 25th, 2011, 1:04 pm
Posts: 11
Thanks for all of your help on this, but, sadly...
No go....

That produces a -632
-632 FFFFFD88 SYSTEM FAILURE
http://www.novell.com/documentation/nwec/

But on the bright side.....it's a different error.....

A day or two ago, I posted my same question to the Novell Client forums, and got this back:

Quote:
The DllCall script shown is printing / displaying three values;
ErrorLevel, LastError and the retcode variable. What was the value in
retcode, specifically?

The return code from the API itself is the only thing being controlled
by Novell code. Neither the ErrorLevel nor the thread last error
(LastError, GetLastError) are set by the Novell XPLAT APIs. They are
perhaps being set by DllCall / AutoHotKey in response to something, or
maybe are just values left over from some other previous call that set
LastError / ErrorLevel.

But since there is an additional layer (AutoHotKey) between your code
and the actual Novell API, it's possible even the return code is being
preemptively set by DllCall without ever actually calling the Novell
API. e.g. If AutoHotKey couldn't convert the script-defined parameter
successfully in preparation for calling the actual API.

If the return code from the Novell API is not zero, it's expected to
be in the range of 0x8800 for local Novell Client errors, 0x8900 for
errors returned from the NCP server, or -1 to -800 for errors from the
eDirectory server. Neither ERROR_ACCESS_DENIED (5) nor
ERROR_INVALID_HANDLE (6 are values returned by the Novell XPLAT APIs.

I don't see the "asterisk as a prefix" within the DllCall examples, so
I'm not positive what "*Int" actually ends up doing. The DllCall
documentation and examples seem to only show use of the asterisk as a
suffix.

That outBuf is treated as ""*Int", outBuf" on both NWDSAllocBuf and
NWDSlist seems suspicious, since NWDSAllocBuf takes the parameter as
"Buf_T * *" (ppBuf_T, pointer to a pointer to a Buf_T structure),
whereas NWDSList takes the parameter as "Buf_T *" (pBuf_T, pointer to
a Buf_T structure). So presumably their DllCall-defined syntax should
not actually be the same for both of those calls.
http://developer.novell.com/documentati ... dk198.html
http://developer.novell.com/documentati ... k2108.html

On a separate note, technically the iteration handle parameter is
INT_PTR rather than INT, but that shouldn't make a practical
difference for you on Windows XP x86 since both pointers and ints are
the same size on that platform.
http://developer.novell.com/documentati ... k2108.html


Thanks again for helping with this issue....

-S


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 7th, 2011, 8:24 pm 
Offline

Joined: May 3rd, 2009, 7:16 pm
Posts: 345
Location: OH, USA
sowen123, you have many problems throughout your code. The biggest problem is that you're not understanding structures and how to use them in AHK. Take a look at this code and I think you will have a better understanding:

Code:
;
; AutoHotkey Version: 1.x
; Language:       English
; Platform:       Win9x/NT
; Author:         A.N.Other <myemail@nowhere.com>
;
; Script Function:
;   Template script (you can customize this template by editing "ShellNew\Template.ahk" in your Windows folder)
;
 
#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.


; initializes NWCallsInit
   nwrc :=DllCall("calwin32\NWCallsInit", UInt, 0, UInt, 0 )
   If nwrc <> 0
   {
   MsgBox Error: NWCallsInit was not successful. That's all I know.
   Exit
   }


; pre-load NetWare netwin32 utility DLL
   hModule := DllCall("LoadLibrary", "str", "netwin32.Dll")
   if !hModule {
   MsgBox Error: Can't load netwin32 DLL. are you SURE the Novell client is on this machine?
   Exit
    }


; Create new context handle
   cCode := DllCall("netwin32.Dll\NWDSCreateContextHandle", "Int*", ctx, "Int")
   if cCode <> 0
   {
   MsgBox Error: NWDSCreateContextHandle was not successful. %cCode%.
   Exit
   }

; Authenticated ??
   cCode := DllCall("netwin32.Dll\NWIsDSAuthenticated", UInt, 0)
   if cCode <> 1
   {
   MsgBox Error: you are not logged in. %cCode%.
   Exit
   }

   DS_ROOT_NAME := "[Root]"

; NWDSSetContext -- set context to root
   retcode := DllCall("netwin32.Dll\NWDSSetContext", "Int", ctx, "Int", 3, "Str", &DS_ROOT_NAME)
   ;msgbox, %Errorlevel%
   If retcode <> 0
   {
   MsgBox, NWDSSetContext returned error %retcode%
   }   


;get default DS tree name from our context (root)
    retcode := DllCall("netwin32.Dll\NWDSGetContext", "Int", ctx, "Int", 11, "Str*", context)
   If retcode <> 0
   {
   MsgBox, NWDSGetContext returned error %retcode%
   }
   ; this produces the correct tree name
   ;msgbox, %DS_ROOT_NAME%


; NWDS who am I.
   cCode2 := DllCall("netwin32.Dll\NWDSWhoAmI", "Int", ctx, "Str*", me)
   if cCode2 <> 0
   {
   MsgBox Error: NWDSWhoAmI was not successful. %cCode2%.
   Exit
   }
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; this prints CN=USERNAME (with context)
;msgbox, %me%

;add leading "." to CN and a CR to the end
me = .%me%`n

msgbox, %me%

MAX_MESSAGE_LEN = 64512
DEFAULT_MESSAGE_LEN = 4096

NO_MORE_ITERATIONS = -1
DSV_READ = 3

; setup inbuf
    retcode := DllCall("netwin32.Dll\NWDSAllocBuf", "uint", DEFAULT_MESSAGE_LEN, "uint*", inBuf)
   ;msgbox, %Errorlevel%
    If retcode <> 0
   {
    MsgBox, Alloc Buffer inbuf returned error %retcode%
   }


; setup outbuf
    retcode := DllCall("netwin32.Dll\NWDSAllocBuf", "uint", DEFAULT_MESSAGE_LEN, "uint*", outBuf)
   ;msgbox, %Errorlevel%
    If retcode <> 0
   {
    MsgBox, Alloc Buffer outbuf returned error %retcode%
   }


; initialize the inBuf
   VarSetCapacity(inBuf, 22) ; t_buf
   ,NumPut(0, t_buf, 0, "uint") ; operation
   ,NumPut(0, t_buf, 4, "uint") ; flags
   ,NumPut(0, t_buf, 8, "uint") ; maxLen
   ,NumPut(0, t_buf, 12, "uint") ; curLen
   ,NumPut(0, t_buf, 16, "ushort") ; lastCount
   ,NumPut(0, t_buf, 18, "ushort") ; curPos
   ,NumPut(0, t_buf, 20, "ushort") ; data
   retcode := DllCall("netwin32.Dll\NWDSInitBuf", "Int", ctx, "UInt", DSV_READ, "uint", &inBuf)
   ;msgbox, %Errorlevel%
    If retcode <> 0
   {
    MsgBox, Init Buffer inbuf returned error %retcode%
   }


; Write "Group Membership" to the inbuf buffer
   retcode := DllCall("netwin32.Dll\NWDSPutAttrName", "Int", ctx, "uint", &inBuf, "Str", "Group Membership")
   ;msgbox, %Errorlevel%
   If retcode <> 0
   {
   MsgBox, Put Attrib Name "Group Membership" returned error %retcode%
   }
   


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; all good until this call.....which produces a windows system ERROR_INVALID_HANDLE error in %A_LastError%

; NWDSlist
   VarSetCapacity(outBuf, 22) ; t_buf
   retcode := DllCall("netwin32.Dll\NWDSList", "Int", ctx, "uint", &me, "Int*", iterread, "uint", &outBuf)
   msgbox, %Errorlevel%
   msgbox, %A_LastError%
   If retcode <> 0
   {
   MsgBox, NWDSlist returned error %retcode%
   }

I have provided how to create your t_buf structure. You need to fill the structure for the NWDSInitBuf call.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 8th, 2011, 3:20 pm 
Offline

Joined: February 25th, 2011, 1:04 pm
Posts: 11
One of the engineers at the Novell forums seems to think that the root of the issue might be related to the NWDSAllocBuf call??
His commets quoted below:


Quote:
> changing iterread to a value (-1)
> ie: NO_MORE_ITERATIONS represented by a negative integer, not a string.
>
> iterread := -1
> retcode := DllCall("netwin32.Dll\NWDSList", "Int", ctx, "Str", me, "Int*", iterread, "Int*", outBuf)

-632 being ERR_SYSTEM_FAILURE from eDirectory library. The only place
I see ERR_SYSTEM_FAILURE being returned from the eDirectory library is
when its trying to grovel data in the prepared buffer and didn't find
the buffer to be in a sane state.

So I would guess this is still likely to be related to the question of
how DllCall intends for one to distinguish between passing the pointer
to a pointer and the pointer itself for outBuf.

The true problem likely exists on the NWDSAllocBuf parameters, where
you were expecting to /receive/ a pointer to a buffer which had been
allocated by NWDSAllocBuf. How exactly you would handle that
situation with DllCall isn't clear from the documentation and is
something you may need to clarify with them or their user community.

The references to "char * *" seem the closest to perhaps what's
needed, but doesn't make it clear how you should then pass that
received pointer as the actual parameter to NWDSList.

("char" doesn't seem right, because you're not trying to pass a
literal character. "char *" doesn't seem right, because you're trying
to pass the address contained /in/ the outBuf variable, not an address
/to/ the outBuf variable. "char * *" doesn't seem right, because
you're not trying to pass a pointer to a pointer any more like you
were on NWDSAllocBuf.)

Maybe search or ask about examples for how one would call the Windows
API WTSQuerySessionInformation, specifically in relation to the fourth
parameter ppBuffer. That would be how you want to handle outBuf on
NWDSAllocBuf. And then the manner in which you would later pass the
buffer received from WTSQuerySessionInformation to WTSFreeMemory is
the manner in which you want to pass outBuf to NWDSList.


Any ideas on the NWDSAllocBuf issue??
A quick search of the forum for "WTSQuerySessionInformation" turned up no hits.....


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 11th, 2011, 4:30 pm 
Offline

Joined: February 25th, 2011, 1:04 pm
Posts: 11
Hi all,


Maybe I should state what I'm actually trying to get as an output?
Maybe there is another/better way than what I'm doing...??

I would like to output a users CN, followed by all groups that the user is a member of.
ie: sowen, admins, InternetUsers, HS_Location, Everyone

where "sowen" is the CN, and all the rest are group names that sowen is a member of.

Right now I seemed to be stopped at NWDSRead giving a "-322" error.


Code:
; AutoHotkey Version: 1.x
; Language:       English
; Platform:       Win9x/NT
; Author:         A.N.Other <myemail@nowhere.com>
;
; Script Function:
;   Template script (you can customize this template by editing "ShellNew\Template.ahk" in your Windows folder)
;
 
#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.


; initializes NWCallsInit
   nwrc :=DllCall("calwin32\NWCallsInit", UInt, 0, UInt, 0 )
   If nwrc <> 0
   {
   MsgBox Error: NWCallsInit was not successful. That's all I know.
   Exit
   }


; pre-load NetWare netwin32 utility DLL
   hModule := DllCall("LoadLibrary", "str", "netwin32.Dll")
   if !hModule {
   MsgBox Error: Can't load netwin32 DLL. are you SURE the Novell client is on this machine?
   Exit
    }


; Create new context handle
   cCode := DllCall("netwin32.Dll\NWDSCreateContextHandle", "Int*", ctx, "Int")
   if cCode <> 0
   {
   MsgBox Error: NWDSCreateContextHandle was not successful. %cCode%.
   Exit
   }

; Authenticated ??
;   cCode := DllCall("netwin32.Dll\NWIsDSAuthenticated", UInt, 0)
;   if cCode <> 1
;   {
;   MsgBox Error: you are not logged in. %cCode%.
;   Exit
;   }


; NWDSSetContext -- set context to root
   retcode := DllCall("netwin32.Dll\NWDSSetContext", "Int", ctx, "Int", 3, "Int", DS_ROOT_NAME)
   ;msgbox, %Errorlevel%
   If retcode <> 0
   {
   MsgBox, NWDSSetContext returned error %retcode%
   }   


;get default DS tree name from our context (root)
   VarSetCapacity(DS_ROOT_NAME, 48)
    retcode := DllCall("netwin32.Dll\NWDSGetContext", "Int", ctx, "Int", 11, "Str", DS_ROOT_NAME)
   If retcode <> 0
   {
   MsgBox, NWDSGetContext returned error %retcode%
   }
   ; this produces the correct tree name
   ;msgbox, %DS_ROOT_NAME%


; NWDS who am I.
   VarSetCapacity(me, 48)
   cCode2 := DllCall("netwin32.Dll\NWDSWhoAmI", "Int", ctx, "Str", me)
   if cCode2 <> 0
   {
   MsgBox Error: NWDSWhoAmI was not successful. %cCode2%.
   Exit
   }
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; this prints CN=USERNAME (with context)
;msgbox, %me%

;add leading "." to Common Name for eDir FQDN
me = .%me%
;msgbox, %me%


MAX_MESSAGE_LEN = 64512
DEFAULT_MESSAGE_LEN = 4096

; setup inbuf
    VarSetCapacity(inBuf, 22) ; t_buf (three shorts + four 32-bit integers (i.e. {4*4=16 + 3*2=6} = 22
   ,NumPut(0x0003, inBuf, 0, "uint") ; operation
   ,NumPut(0x0001, inBuf, 4, "uint") ; flags
   ,NumPut(64512, inBuf, 8, "uint") ; maxLen
   ,NumPut(0, inBuf, 12, "uint") ; curLen
   ,NumPut(0, inBuf, 16, "ushort") ; lastCount
   ,NumPut(0, inBuf, 18, "ushort") ; curPos
   ,NumPut(0, inBuf, 20, "ushort") ; data
    retcode := DllCall("netwin32.Dll\NWDSAllocBuf", "UShort*", %DEFAULT_MESSAGE_LEN%, "Uint*", inBuf)
   ;msgbox, %Errorlevel%
    If retcode <> 0
   {
    MsgBox, Alloc Buffer inbuf returned error %retcode%
   }


; setup outbuf
    retcode := DllCall("netwin32.Dll\NWDSAllocBuf", "UShort*", %DEFAULT_MESSAGE_LEN%, "Uint*", outBuf)
 ;msgbox, %Errorlevel%
    If retcode <> 0
 {
    MsgBox, Alloc Buffer outbuf returned error %retcode%
 }


; initialize the inBuf
 retcode := DllCall("netwin32.Dll\NWDSInitBuf", "Int", ctx, "UInt", 3, "UInt", inBuf)
 ;msgbox, %Errorlevel%
   If retcode <> 0
 {
    MsgBox, Init Buffer inbuf returned error %retcode%
 }



; Write "Group Membership" to the inbuf buffer
   retcode := DllCall("netwin32.Dll\NWDSPutAttrName", "Int", ctx, "UInt", inBuf, "Str", "Group Membership")
   ;msgbox, %Errorlevel%
   If retcode <> 0
   {
   MsgBox, Put Attrib Name "Group Membership" returned error %retcode%
 }


;str:=inBuf
;loop
;msgbox % nStr.=chr( *str++ )
;;;;;;;;;; after a few ascii chars. this displays the string "Group Membership (no ending quote..but it might be at the end of the buffer data ??)
;;;;;;;;;; this leads me to believe that "Group Membership" is being written correctly to the inBuf.
;;;;;;;;;; I have to press "OK" twice for each letter (Unicode?)


SetIterHandl := "NO_MORE_ITERATIONS"
;;;;;;;;;;;sets the var "SetIterHandl" to contain NO_MORE_ITERATIONS


VarSetCapacity(IterationHandle, 4)
,NumPut(&SetIterHandl, IterationHandle, 0, "UInt")
;;;;;;;;;;;;; sets the capacity of iterationHandle to 4 bytes (the size of 1 32-bit integer)
;;;;;;;;;;;;; puts the address of "SetIterHandl" in the "0" (first) offset of the variable "IterationHandle" and assigns it as an UInt.


;;;;;;;;;;look at the data in IterationHandle;;;;;;;;;;;;;;;;;;;
MyHandle := NumGet(IterationHandle, 0)
msgbox, %MyHandle%
;;;;;;;;;;;;; this produces a pointer (positive integer) as %MyHandle%


;str:=MyHandle
;loop
;msgbox % nStr.=chr( *str++ )
;;;;;;;;;;;;;;; if I use this to step through "MyHandle" I can see the text "NO_MORE_ITERATIONS" (unquoted);;;;;;;;;;;;;;;;;



;Read the attrib values etc from NDS
   retcode := DllCall("netwin32.Dll\NWDSRead", "Int", ctx, "Str", me, "UInt", 1, "UInt", False, "UInt", inBuf, "UInt", &IterationHandle, "UInt", outBuf)
    msgbox, %ctx%
    msgbox, %me%
    msgbox, %inBuf%
    msgbox, %IterationHandle%
    msgbox, %outbuf%
    msgbox, %Errorlevel%
 If retcode <> 0
 {
 MsgBox, NWDSRead returned error %retcode%
 }



I believe I am following the correct process as outlined here:
http://www.autohotkey.com/docs/commands/DllCall.htm

But I keep getting a "-322" for a retcode on the NWDSRead call.

The var %IterationHandle% reads as ascii code.

Substituting
"UInt *", MyHandle
for
"UInt", &IterationHandle

produces a positive integer (pointer) for %MyHandle%, but still produces a -322 NDS error.
Any ideas on how to handle the Iteration handle???

http://developer.novell.com/education/nds/cndap/ndapreadattrib/ndapReadAttrib4.html

http://developer.novell.com/documentation//ndslib/nds__enu/index.html?page=/documentation//ndslib/nds__enu/data/h7d6try4.html
Thanks,

-S


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Google Feedfetcher and 16 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group