WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

DllCall Information

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Find a DFS Target Given a DFS Link


Find a DFS Target given a DFS link.

NetDFSGetInfo API

#DefineFunction GetDFStarget ( DFSLink )

DfsLinkWide=BinaryAlloc(1000)
BinaryPokeStr(DfsLinkWide,0,DfsLink)
BinaryConvert(DfsLinkWide,0,3,0,0) ; convert to unicode


KernelFQFN = StrCat ( DirWindows ( 1 ) , 'NETAPI32.DLL' )

; allocate memory for the pointer to the structure that will be returned from the dllcall function.

p0 = BinaryAlloc (4) ; Pointer to structure.
BinaryPoke4(p0,0,1) ; Populate the pointer
BinaryEodSet(p0,4) ; set end of data to 4 bytes
operation="3" ; parameter that says we want DFS target information.
operation=Int(operation) ; convert the type to Integer

;message("DFSLink", KernelFQFN)

; dllcall (
; dll name where the function resides,
; entry point (function),
; not used,
; not used,
; parameter listed above,
; pointer to the location in memory where the data will be
; )
handle=""
handle = DllLoad(KernelFQFN)

rtn = DllCall (handle, long:"NetDfsGetInfo", lpbinary:DfsLinkWide, lpnull, lpnull, long:operation, lpbinary:p0)


;extract data here


DllFree(handle)
BinaryFree(KernelFQFN)
BinaryFree(DfsLinkWide)
BinaryFree(p0)


Article ID:   W16951
File Created: 2009:06:10:08:15:24
Last Updated: 2009:06:10:08:15:24