Test.obj : error LNK2001: unresolved external symbol _NetApiBufferFree@4
那位能帮我编译下这段代码.看看是不是我系统有问题,因为是msdn中的代码
以下是msdn中的代码:
#define UNICODE
#include <windows.h>
#include <stdio.h>
#include <lm.h>void wmain( int argc, TCHAR *lpszArgv[ ])
{
PSHARE_INFO_502 BufPtr;
NET_API_STATUS res;
LPTSTR lpszServer = NULL, lpszShare;
//
// Check command line arguments.
//
switch(argc)
{
case 3:
lpszServer = lpszArgv[2];
case 2:
lpszShare = lpszArgv[1];
break;
default:
printf("Usage: NetShareGetInfo sharename <servername>\n");
return;
}
//
// Call the NetShareGetInfo function, specifying level 502.
//
if((res = NetShareGetInfo (lpszServer,lpszShare,502,(LPBYTE *) &BufPtr)) == ERROR_SUCCESS)
{
//
// Print the retrieved data.
//
printf("%S\t%S\t%u\n",BufPtr->shi502_netname, BufPtr->shi502_path, BufPtr->shi502_current_uses);
//
// Validate the value of the
// shi502_security_descriptor member.
//
if (IsValidSecurityDescriptor(BufPtr->shi502_security_descriptor))
printf("It has a valid Security Descriptor.\n");
else
printf("It does not have a valid Security Descriptor.\n");
//
// Free the allocated memory.
//
NetApiBufferFree(BufPtr);
}
else
printf("Error: %ld\n",res);
return;
}
那位能帮我编译下这段代码.看看是不是我系统有问题,因为是msdn中的代码
以下是msdn中的代码:
#define UNICODE
#include <windows.h>
#include <stdio.h>
#include <lm.h>void wmain( int argc, TCHAR *lpszArgv[ ])
{
PSHARE_INFO_502 BufPtr;
NET_API_STATUS res;
LPTSTR lpszServer = NULL, lpszShare;
//
// Check command line arguments.
//
switch(argc)
{
case 3:
lpszServer = lpszArgv[2];
case 2:
lpszShare = lpszArgv[1];
break;
default:
printf("Usage: NetShareGetInfo sharename <servername>\n");
return;
}
//
// Call the NetShareGetInfo function, specifying level 502.
//
if((res = NetShareGetInfo (lpszServer,lpszShare,502,(LPBYTE *) &BufPtr)) == ERROR_SUCCESS)
{
//
// Print the retrieved data.
//
printf("%S\t%S\t%u\n",BufPtr->shi502_netname, BufPtr->shi502_path, BufPtr->shi502_current_uses);
//
// Validate the value of the
// shi502_security_descriptor member.
//
if (IsValidSecurityDescriptor(BufPtr->shi502_security_descriptor))
printf("It has a valid Security Descriptor.\n");
else
printf("It does not have a valid Security Descriptor.\n");
//
// Free the allocated memory.
//
NetApiBufferFree(BufPtr);
}
else
printf("Error: %ld\n",res);
return;
}
解决方案 »
- VS2008中使用ODBC连接的数据源,新建的MFC类中怎么没有CRecordSet基类
- 多年解决的问题!
- 在visual studio 2005 中 doc 可以相应系统消息吗?
- 求救,急,在VC 用ADO 打开oracle 中包含blob字段的表的recordset 异常
- 2008年07月22日 周二 高新技术企业IT、电子 在海淀分部举行
- 请教:有关com组件是否需要idl文件的问题??(在线等待各位的帮助)
- 问一个VC中绘制图形的问题?
- 关于smartdrv.exe文件?
- ■■■■关于 CDialog 使用
- 困惑:跳槽到现在的公司,虽然money多了一点,可总觉得不如以前那么开心,怎么办?
- 关于dllimport的问题!
- 关于WebBrowser的问题
#pragma comment(lib, "Svrapi") //加一句这个就行了.
相关的库没包含.
我加了这句还是不行
换成这个就好了.库名我弄错了.