Thanks again Jose' and Michael for your insight
Jose' I went with your way much cleaner than the way I was doing it
Announcement
Collapse
No announcement yet.
Has anyone translated LMDFS
Collapse
X
-
Only nagging question is why it fails .... if I do not include acode$ I get 1722 error invalid parameter
You might have better luc with those unicode paths using something like
Code:%UNICODE_BUFFER_SIZE = %MAX_PATH * 2 + 2 LOCAL wStrEntryPath AS STRING* %UNCODE_BUFFER_SIZE
What you want is "TYPE SET wStrEntryPath = UCODE$(ansi_string) USING $NUL"
The compiler really could use a "WSTRINGZ * size" data type so we would not have to screw around dealing with the Unicode nulls ourselves.
MCM
Leave a comment:
-
-
Folderpath = "\\DFSServer\DFSROOT\DIR1" '<-- This must point to valid DFS server will not use drive letter mapping
multibytetowidechar %CP_ACP, 0, ACODE$(StrToUnicode(FolderPath)), -1 , BYVAL VARPTR(wstrEntryPath), %MAX_PATH
dwdResult = VARPTR(wstrEntryPath)
Result = NetDFSGetInfo(dwdResult, %NULL, %NULL, 3, DFSData)
Code:Folderpath = UCODE$("\\DFSServer\DFSROOT\DIR1") Result = NetDFSGetInfo(STRPTR(FolderPath), %NULL, %NULL, 3, DFSData)
Leave a comment:
-
-
Here is the somewhat working test code. Only nagging question is why it fails with invalid paramter unless in the MultibytetoWideChar you include either
ACODE$(StrToUnicode(FolderPath))
or "\\DFSSERVER\DFSROOT\DIR" States, looking for a pointer if I do not include acode$ I get 1722 error invalid parameter.
Test code for NetDFSGetInfo:
Code:'Includes Contributed by: Jose Roca #INCLUDE "WIN32API.inc" '<-- JRoca includes #INCLUDE "LM.inc" '<-- NetAPIBufferFree declare #INCLUDE "LMDFS.inc" '<-- NetDFS include 'From Powerbasic Forum (www.powerbasic.com) 'Contributed by George Bleck 12/1/2001 FUNCTION UnicodePtrtoStr(BYVAL dwdConvert AS DWORD) AS STRING LOCAL lngLength AS LONG LOCAL strBuffer AS STRING lngLength = lstrlenw(BYVAL dwdConvert) strBuffer = SPACE$(lngLength) widechartomultibyte 0, %NULL, BYVAL dwdConvert, lngLength, BYVAL STRPTR(strBuffer), _ LEN(strBuffer), BYVAL %NULL, BYVAL %NULL FUNCTION = strBuffer END FUNCTION 'From Powerbasic Forum (www.powerbasic.com) 'Contributed by George Bleck 12/1/2001 FUNCTION StrToUnicode(BYVAL sConvert AS STRING) AS STRING LOCAL lngLength AS LONG LOCAL strBuffer AS STRING lngLength = LEN(sConvert) strBuffer = SPACE$(lngLength * 2) MultiByteToWideChar 0, %NULL, BYVAL STRPTR(sConvert), lngLength, BYVAL STRPTR(strbuffer), LEN(strBuffer) FUNCTION = strBuffer + CHR$(0,0) END FUNCTION FUNCTION PBMAIN () AS LONG LOCAL DFSData AS DFS_INFO_3 PTR LOCAL Result AS DWORD LOCAL FolderPath AS STRING, wstrEntryPath AS ASCIIZ * (2 * %MAX_PATH) LOCAL dwdResult AS DWORD Folderpath = "\\DFSServer\DFSROOT\DIR1" '<-- This must point to valid DFS server will not use drive letter mapping multibytetowidechar %CP_ACP, 0, ACODE$(StrToUnicode(FolderPath)), -1 , BYVAL VARPTR(wstrEntryPath), %MAX_PATH dwdResult = VARPTR(wstrEntryPath) Result = NetDFSGetInfo(dwdResult, %NULL, %NULL, 3, DFSData) IF result = 0 THEN MSGBOX "\\" & UnicodePtrtoStr(@[email protected]) & _ "\" & UnicodePtrtoStr(@[email protected]) NetAPiBufferfree(DFSData) ELSE MSGBOX "Failure Reason: " & STR$(Result) END IF END FUNCTION
Leave a comment:
-
-
José Roca has translated that header and a lot of others in to powerbasic inlcude files. His translations are based on the C headers. He has done a great job of it. I just checked and he does have the LMDFS header converted and ready to use.
You can find those files here:
Note: You must register and sign in before you will be able to download the files. But his site is loaded with good advice and information, so it is well worth it.
Hope that helps,
Leave a comment:
-
-
Has anyone translated LMDFS
Has anyone translated the LMDFS Header file?
or have a sample of using NetDfsGetInfo API call they would not mind sharing?
Thanks in AdvanceTags: None
-
Leave a comment: