图片1是导出函数,图片2是导出函数里面调用了本地函数的代码,可以看到这时候二级指针参数,char ** argv,这时候还是有值的,等我调试到了图片3的函数 argv参数的值就没有了。
这里附上个完整的导出函数代码
extern "C" __declspec(dllexport) BOOL phadb_exeCmdLine(const char* strCmdLine,char *strOut)
{
/***************************************************************************************/
int t = 0;
int flag = 0, stop = 0, num = 0;
char argv[ADB_CMDLINEMAX][_MAX_PATH];
char **pargv = new char *[ADB_CMDLINEMAX];
for (int i = 0; i<ADB_CMDLINEMAX; i++)
{
pargv[i] = new char[_MAX_PATH];
}
for (size_t i = 0; i < ADB_CMDLINEMAX; i++) {
memset(argv[i], 0, _MAX_PATH);
memset(pargv[i], 0, _MAX_PATH);
}
for (size_t i = 0; i < strlen(strCmdLine)/*.size()*/; i++)
{
if (strCmdLine[i]/*.at(i)*/ != 32){
memcpy(&argv[flag][num], &strCmdLine[t], 1);
//argv[flag][num] = strCmdLine[t]/*.at(t)*/;
num++;
stop = 0;
}
else if (strCmdLine[t]/*.at(t)*/ == 32 && stop == 0)
{
flag++;
num = 0;
stop = 1;
}t++;
}
for (size_t i = 0; i < ADB_CMDLINEMAX; i++){
memcpy(pargv[i], argv[i], _MAX_PATH);
}
int argc = flag;
BOOL nRet = TRUE;
if (argc > 0 ){
nRet = adb_commandline(argc, (char**)argv);
fread(strOut, 1, 256, stderr);
if (nRet == FALSE)
{
return nRet;
}
}
return nRet;
/*******************************************************************************************/
}