nohj
asked on
What is lpBuffer ?
Using Delphi 3 Pro
I am trying to get info about files sytems/disks on network servers using
WNetEnumResource, however, I cannot find what type lpBuffer should be declared as.
Could anyone give me an example starting with WNetOpenEnum through WNetEnumResource to WNetCloseEnum.
Thanks
John
I am trying to get info about files sytems/disks on network servers using
WNetEnumResource, however, I cannot find what type lpBuffer should be declared as.
Could anyone give me an example starting with WNetOpenEnum through WNetEnumResource to WNetCloseEnum.
Thanks
John
yup,
a lpBuffer is a pointer to an allocated memory-area
(must mostly allocated byself before use)
meikl ;-)
a lpBuffer is a pointer to an allocated memory-area
(must mostly allocated byself before use)
meikl ;-)
I suggest that you use the Delphi build-in structures:
PNetResourceA = ^TNetResourceA;
PNetResourceW = ^TNetResourceW;
PNetResource = PNetResourceA;
{$EXTERNALSYM _NETRESOURCEA}
_NETRESOURCEA = packed record
dwScope: DWORD;
dwType: DWORD;
dwDisplayType: DWORD;
dwUsage: DWORD;
lpLocalName: PAnsiChar;
lpRemoteName: PAnsiChar;
lpComment: PAnsiChar;
lpProvider: PAnsiChar;
end;
{$EXTERNALSYM _NETRESOURCEW}
_NETRESOURCEW = packed record
dwScope: DWORD;
dwType: DWORD;
dwDisplayType: DWORD;
dwUsage: DWORD;
lpLocalName: PWideChar;
lpRemoteName: PWideChar;
lpComment: PWideChar;
lpProvider: PWideChar;
end;
{$EXTERNALSYM _NETRESOURCE}
_NETRESOURCE = _NETRESOURCEA;
TNetResourceA = _NETRESOURCEA;
TNetResourceW = _NETRESOURCEW;
TNetResource = TNetResourceA;
{$EXTERNALSYM NETRESOURCEA}
NETRESOURCEA = _NETRESOURCEA;
{$EXTERNALSYM NETRESOURCEW}
NETRESOURCEW = _NETRESOURCEW;
{$EXTERNALSYM NETRESOURCE}
NETRESOURCE = NETRESOURCEA;
If you choose the ansi version declare a MyBuffer as TNetResourceA (Well, you don't have to call it "buffer");
Reference this variable on call to the Enum function.
Regards
PNetResourceA = ^TNetResourceA;
PNetResourceW = ^TNetResourceW;
PNetResource = PNetResourceA;
{$EXTERNALSYM _NETRESOURCEA}
_NETRESOURCEA = packed record
dwScope: DWORD;
dwType: DWORD;
dwDisplayType: DWORD;
dwUsage: DWORD;
lpLocalName: PAnsiChar;
lpRemoteName: PAnsiChar;
lpComment: PAnsiChar;
lpProvider: PAnsiChar;
end;
{$EXTERNALSYM _NETRESOURCEW}
_NETRESOURCEW = packed record
dwScope: DWORD;
dwType: DWORD;
dwDisplayType: DWORD;
dwUsage: DWORD;
lpLocalName: PWideChar;
lpRemoteName: PWideChar;
lpComment: PWideChar;
lpProvider: PWideChar;
end;
{$EXTERNALSYM _NETRESOURCE}
_NETRESOURCE = _NETRESOURCEA;
TNetResourceA = _NETRESOURCEA;
TNetResourceW = _NETRESOURCEW;
TNetResource = TNetResourceA;
{$EXTERNALSYM NETRESOURCEA}
NETRESOURCEA = _NETRESOURCEA;
{$EXTERNALSYM NETRESOURCEW}
NETRESOURCEW = _NETRESOURCEW;
{$EXTERNALSYM NETRESOURCE}
NETRESOURCE = NETRESOURCEA;
If you choose the ansi version declare a MyBuffer as TNetResourceA (Well, you don't have to call it "buffer");
Reference this variable on call to the Enum function.
Regards
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
var
MyBuff : Pointer;
size : DWord;
begin
size := 100; //size in bytes;
MyBuff := allocmem(size);
Rob ;-)
P.S.
or you could just pass an array of char