This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Using Win Api Function NetShareGetInfo
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jul 22, 2014
02:36 AM
Using Win Api Function NetShareGetInfo
Hello,
I'm using Windows API function NetShareGetInfo in ISScript.
This function gives back dynamically allocated buffer.
How do I read the buffer, convert it to strings?
I'd appreciate anyone's help...
Sample code:
typedef SHARE_INFO_502
begin
POINTER shi502_netname;
LONG shi502_type;
POINTER shi502_remark;
LONG shi502_permissions;
LONG shi502_max_uses;
LONG shi502_current_uses;
POINTER shi502_path;
POINTER shi502_passwd;
LONG shi502_reserved;
LONG shi502_security_descriptor;
end;
prototype NUMBER Netapi32.NetShareGetInfo (LONG, BYREF STRING,LONG, POINTER);
let's call this function:
STRING lpShare;
NUMBER res;
LONG mvarNET_API_STATUS;
LONG level;
SHARE_INFO_502 s502;
SHARE_INFO_502 POINTER p502;
lpShare ="S h a r e d "; // LPWSTR
for dw=0 to StrLength(lpShare)
if(lpShare[dw]==" ") then
lpShare[dw]="\0";
endif;
endfor;
p502 = &s502;
level= 502;
mvarNET_API_STATUS = Netapi32.NetShareGetInfo(0, lpShare, level, p502);
return value is 0 - no error.
p502 gives memory allocation which I do not know how to decode it.
I'm using Windows API function NetShareGetInfo in ISScript.
This function gives back dynamically allocated buffer.
How do I read the buffer, convert it to strings?
I'd appreciate anyone's help...
Sample code:
typedef SHARE_INFO_502
begin
POINTER shi502_netname;
LONG shi502_type;
POINTER shi502_remark;
LONG shi502_permissions;
LONG shi502_max_uses;
LONG shi502_current_uses;
POINTER shi502_path;
POINTER shi502_passwd;
LONG shi502_reserved;
LONG shi502_security_descriptor;
end;
prototype NUMBER Netapi32.NetShareGetInfo (LONG, BYREF STRING,LONG, POINTER);
let's call this function:
STRING lpShare;
NUMBER res;
LONG mvarNET_API_STATUS;
LONG level;
SHARE_INFO_502 s502;
SHARE_INFO_502 POINTER p502;
lpShare ="S h a r e d "; // LPWSTR
for dw=0 to StrLength(lpShare)
if(lpShare[dw]==" ") then
lpShare[dw]="\0";
endif;
endfor;
p502 = &s502;
level= 502;
mvarNET_API_STATUS = Netapi32.NetShareGetInfo(0, lpShare, level, p502);
return value is 0 - no error.
p502 gives memory allocation which I do not know how to decode it.
(2) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jul 22, 2014
04:33 AM
Take a look at installsite.org, there you find this code snippet:
http://www.installsite.org/files/NetShareRul.zip
regards
Markus
http://www.installsite.org/files/NetShareRul.zip
regards
Markus
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jul 22, 2014
09:22 AM
Thanks. It helps!