maya123
February 14th, 2007, 05:00 PM
The following code compiled find and when I run it, I am getting error 1113
which means the following
No mapping for the Unicode character exists in the target multi-byte code.
I dont know what is wrong with the parameters being passed to the
NetShareEnum () function.
I am using VS.net 2003 to compile.
---------------------------
#include "stdafx.h"
//#define UNICODE
#include <stdio.h>
#include <windows.h>
#include <tchar.h>
#include <Lm.h>
#include <LMShare.h>
#include <aclapi.h>
int main( )
{
PSHARE_INFO_502 BufPtr,p;
NET_API_STATUS res;
LPWSTR lpszServer = NULL;
DWORD er=0,tr=0,resume=0, i;
char *name = "core";
//
// Print a report header.
//
printf("Share: Local Path: Uses: Descriptor:\n");
printf("---------------------------------------------------------------------\n");
//
// Call the NetShareEnum function; specify level 502.
//
do // begin do
{
res = NetShareEnum ((LPSTR)name, 502, (LPBYTE *) &BufPtr, -1, (LPDWORD)&er, (LPDWORD)&tr, (LPDWORD)&resume);
//
// If the call succeeds,
//
if(res == ERROR_SUCCESS || res == ERROR_MORE_DATA)
{
p=BufPtr;
//
// Loop through the entries;
// print retrieved data.
//
for(i=1;i<=er;i++)
{
printf("%-20S%-30S%-8u",p->shi502_netname, p->shi502_path, p->shi502_current_uses);
//
// Validate the value of the
// shi502_security_descriptor member.
//
if (IsValidSecurityDescriptor(p->shi502_security_descriptor))
printf("Yes\n");
else
printf("No\n");
p++;
}
//
// Free the allocated buffer.
//
// NetApiBufferFree(BufPtr);
}
else
printf("Error: %ld\n",res);
}
// Continue to call NetShareEnum while
// there are more entries.
//
while (res==ERROR_MORE_DATA); // end do
return 0;
}
which means the following
No mapping for the Unicode character exists in the target multi-byte code.
I dont know what is wrong with the parameters being passed to the
NetShareEnum () function.
I am using VS.net 2003 to compile.
---------------------------
#include "stdafx.h"
//#define UNICODE
#include <stdio.h>
#include <windows.h>
#include <tchar.h>
#include <Lm.h>
#include <LMShare.h>
#include <aclapi.h>
int main( )
{
PSHARE_INFO_502 BufPtr,p;
NET_API_STATUS res;
LPWSTR lpszServer = NULL;
DWORD er=0,tr=0,resume=0, i;
char *name = "core";
//
// Print a report header.
//
printf("Share: Local Path: Uses: Descriptor:\n");
printf("---------------------------------------------------------------------\n");
//
// Call the NetShareEnum function; specify level 502.
//
do // begin do
{
res = NetShareEnum ((LPSTR)name, 502, (LPBYTE *) &BufPtr, -1, (LPDWORD)&er, (LPDWORD)&tr, (LPDWORD)&resume);
//
// If the call succeeds,
//
if(res == ERROR_SUCCESS || res == ERROR_MORE_DATA)
{
p=BufPtr;
//
// Loop through the entries;
// print retrieved data.
//
for(i=1;i<=er;i++)
{
printf("%-20S%-30S%-8u",p->shi502_netname, p->shi502_path, p->shi502_current_uses);
//
// Validate the value of the
// shi502_security_descriptor member.
//
if (IsValidSecurityDescriptor(p->shi502_security_descriptor))
printf("Yes\n");
else
printf("No\n");
p++;
}
//
// Free the allocated buffer.
//
// NetApiBufferFree(BufPtr);
}
else
printf("Error: %ld\n",res);
}
// Continue to call NetShareEnum while
// there are more entries.
//
while (res==ERROR_MORE_DATA); // end do
return 0;
}