Vs2010 无法启动文件“....exe”系统找不到指定文件

wyl43381998 2014-12-02 09:46:19



整个工程的目录



以下是\InstallExe 的源代码

// InstallExe.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "..\common\xinstall.h"

void GetPath(OUT TCHAR *sPath)
{
TCHAR sFilename[MAX_PATH];
TCHAR sDrive[_MAX_DRIVE];
TCHAR sDir[_MAX_DIR];
TCHAR sFname[_MAX_FNAME];
TCHAR sExt[_MAX_EXT];

GetModuleFileName(NULL, sFilename, _MAX_PATH);

_tsplitpath(sFilename, sDrive, sDir, sFname, sExt);

_tcscpy(sPath, sDrive);
_tcscat(sPath, sDir);

if(sPath[_tcslen(sPath) - 1] != _T('\\'))
_tcscat(sPath, _T("\\"));
}

void PrintReturnCode()
{
printf("\n");
printf(" 0 Success.\n");
printf(" -801 The TcpIpDog service provider not installed.\n");
printf(" -802 The TcpIpDog service provider already installed.\n");
printf(" -803 Failed to open registry.\n");
printf(" -804 Failed to save the path of TcpIpDog service provider.\n");
printf(" -805 Failed to read the registry value.\n");
printf(" -806 Failed to create the key in the registry.\n");
printf(" -807 Failed to set the value of the key in the registry.\n");
printf(" -808 Failed to delete the key of registry.\n");
}

int main(int argc, char* argv[])
{
__try
{
if(argc <= 1 || argc >= 3)
{
printf("Install [-install | -remove]\n");
printf(" -install : used to install tcpipdog service provider.\n");
printf(" -remove : used to remove the tcpipdog service provider.\n");
system("cause");
return 0;
}

CXInstall m_Install;

if(_tcscmp(argv[1], _T("-install")) == 0)
{
TCHAR sProvider[MAX_PATH];

GetPath(sProvider);

if(sProvider[0] == '\0')
{
printf("Can't find the application path.\n");
system("cause");
return 0;
}

_tcscat(sProvider, XFILTER_SERVICE_DLL_NAME);

if(_taccess(sProvider, 0) == -1)
{
printf("Can't find %s", sProvider);
system("cause");
return 0;
}

printf("Install The TcpIpDog Service Provider...\n\n");
printf("Return Code: %d\n", m_Install.InstallProvider(sProvider));
PrintReturnCode();
system("cause");
return 0;
}
else if(_tcscmp(argv[1], _T("-remove")) == 0)
{
printf("Remove the TcpIpDog service provider...\n\n");
printf("Return Code: %d\n", m_Install.RemoveProvider());
PrintReturnCode();
system("cause");
return 0;
}

printf("Invaid parameter.\n");
system("cause");

return 0;
}
__finally
{
printf("\nCopyRight (c) 2001 Xstudio Technology.\nAll Right Reserved.\n\n");
}
system("cause");

return 0;

}



// stdafx.cpp : source file that includes just the standard includes
// InstallExe.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information

#include "stdafx.h"

// TODO: reference any additional headers you need in STDAFX.H
// and not in this file


// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//

#if !defined(AFX_STDAFX_H__B31F9489_22FC_46B2_B768_7A90EEA9BED4__INCLUDED_)
#define AFX_STDAFX_H__B31F9489_22FC_46B2_B768_7A90EEA9BED4__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers

#include <afxwin.h>
#include <winsock2.h>
#include <io.h>
#include <stdio.h>

// TODO: reference additional headers your program requires here

#include "..\common\debug.h"

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_STDAFX_H__B31F9489_22FC_46B2_B768_7A90EEA9BED4__INCLUDED_)


...全文
5170 9 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
weixin_38188275 2017-08-03
  • 打赏
  • 举报
回复
VS2015同样的问题,请问有大神解决么?
qq_36965027 2016-12-07
  • 打赏
  • 举报
回复
怎么弄的,教教我啊
qq_34953792 2016-09-30
  • 打赏
  • 举报
回复
你们解决了么?大神教教我怎么调啊?
Nitpicking 2015-04-19
  • 打赏
  • 举报
回复
楼主 你的这个问题解决了么 我现在遇到的问题 和你这个 有一样 希望你有时间回复和我说一下啊 万分感谢!
wyl43381998 2014-12-03
  • 打赏
  • 举报
回复
引用 2 楼 hslinux 的回复:
编译后的执行文件找不到?看下你项目配置里面设置的执行路径是否跟你文件生成路径一致。
您好:执行文件目录 输出目录和中介目录 目前的错误
hslinux 2014-12-03
  • 打赏
  • 举报
回复
编译后的执行文件找不到?看下你项目配置里面设置的执行路径是否跟你文件生成路径一致。
Aist-memory 2014-12-03
  • 打赏
  • 举报
回复
是否编译模式变了
赵4老师 2014-12-03
  • 打赏
  • 举报
回复
关闭UAC、防火墙、杀毒软件、……
FightForProgrammer 2014-12-02
  • 打赏
  • 举报
回复
不是代码的问题啦。是你的相应目录下少个文件啊。。。错误说的很清楚啊。少了神马你就找到那个文件放到相应目录不就行了

24,860

社区成员

发帖
与我相关
我的任务
社区描述
C/C++ 工具平台和程序库
社区管理员
  • 工具平台和程序库社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧