Merge branch 'master' of http://192.168.100.140:8099/sane/code_app
This commit is contained in:
commit
e277ae6849
|
@ -164,18 +164,20 @@ SOURCES += \
|
||||||
../../../app/upgrade/HGUpgrade.cpp \
|
../../../app/upgrade/HGUpgrade.cpp \
|
||||||
../../../app/upgrade/main.cpp \
|
../../../app/upgrade/main.cpp \
|
||||||
../../../app/upgrade/mainwindow.cpp \
|
../../../app/upgrade/mainwindow.cpp \
|
||||||
|
../../../modules/base/HGIni.cpp \
|
||||||
../../../modules/base/HGMd5.cpp \
|
../../../modules/base/HGMd5.cpp \
|
||||||
../../../modules/base/HGUtility.cpp \
|
../../../modules/base/HGUtility.cpp \
|
||||||
../../../modules/base/HGThread.cpp \
|
../../../modules/base/HGThread.cpp \
|
||||||
../../../utility/HGString.cpp
|
../../../utility/HGString.cpp \
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
../../../app/upgrade/HGUpgrade.h \
|
../../../app/upgrade/HGUpgrade.h \
|
||||||
../../../app/upgrade/mainwindow.h \
|
../../../app/upgrade/mainwindow.h \
|
||||||
|
../../../modules/base/HGIni.h \
|
||||||
../../../modules/base/HGMd5.h \
|
../../../modules/base/HGMd5.h \
|
||||||
../../../modules/base/HGUtility.h \
|
../../../modules/base/HGUtility.h \
|
||||||
../../../modules/base/HGThread.h \
|
../../../modules/base/HGThread.h \
|
||||||
../../../utility/HGString.h
|
../../../utility/HGString.h \
|
||||||
|
|
||||||
FORMS += \
|
FORMS += \
|
||||||
../../../app/upgrade/mainwindow.ui
|
../../../app/upgrade/mainwindow.ui
|
||||||
|
|
|
@ -168,6 +168,8 @@
|
||||||
<Add option="-z defs" />
|
<Add option="-z defs" />
|
||||||
<Add option="-B direct" />
|
<Add option="-B direct" />
|
||||||
</Linker>
|
</Linker>
|
||||||
|
<Unit filename="../../../modules/base/HGIni.cpp" />
|
||||||
|
<Unit filename="../../../modules/base/HGIni.h" />
|
||||||
<Unit filename="../../../modules/base/HGUtility.cpp" />
|
<Unit filename="../../../modules/base/HGUtility.cpp" />
|
||||||
<Unit filename="../../../modules/base/HGUtility.h" />
|
<Unit filename="../../../modules/base/HGUtility.h" />
|
||||||
<Unit filename="../../../sdk/upload/main.cpp" />
|
<Unit filename="../../../sdk/upload/main.cpp" />
|
||||||
|
|
|
@ -19,11 +19,13 @@
|
||||||
</ProjectConfiguration>
|
</ProjectConfiguration>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ClCompile Include="..\..\..\modules\base\HGIni.cpp" />
|
||||||
<ClCompile Include="..\..\..\modules\base\HGUtility.cpp" />
|
<ClCompile Include="..\..\..\modules\base\HGUtility.cpp" />
|
||||||
<ClCompile Include="..\..\..\sdk\upload\main.cpp" />
|
<ClCompile Include="..\..\..\sdk\upload\main.cpp" />
|
||||||
<ClCompile Include="..\..\..\third_party\cgic\cgic.c" />
|
<ClCompile Include="..\..\..\third_party\cgic\cgic.c" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ClInclude Include="..\..\..\modules\base\HGIni.h" />
|
||||||
<ClInclude Include="..\..\..\modules\base\HGUtility.h" />
|
<ClInclude Include="..\..\..\modules\base\HGUtility.h" />
|
||||||
<ClInclude Include="..\..\..\third_party\cgic\cgic.h" />
|
<ClInclude Include="..\..\..\third_party\cgic\cgic.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#include "HGUtility.h"
|
#include "HGUtility.h"
|
||||||
#include "HGInc.h"
|
#include "HGInc.h"
|
||||||
|
#include "HGIni.h"
|
||||||
#if defined(HG_CMP_MSC)
|
#if defined(HG_CMP_MSC)
|
||||||
#include <shlobj.h>
|
#include <shlobj.h>
|
||||||
#include <atlstr.h>
|
#include <atlstr.h>
|
||||||
|
@ -170,18 +171,28 @@ HGResult HGAPI HGBase_GetModuleName(HGPointer addr, HGChar* name, HGUInt maxLen)
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(HG_CMP_MSC)
|
#if !defined(HG_CMP_MSC)
|
||||||
Dl_info dlinfo;
|
if (NULL == addr)
|
||||||
if (0 == dladdr(addr, &dlinfo))
|
{
|
||||||
return HGBASE_ERR_FAIL;
|
char dir[PATH_MAX] = {0};
|
||||||
if (maxLen < strlen(dlinfo.dli_fname) + 1)
|
if (0 == readlink("/proc/self/exe", dir, PATH_MAX))
|
||||||
return HGBASE_ERR_FAIL;
|
return HGBASE_ERR_FAIL;
|
||||||
strcpy(name, dlinfo.dli_fname);
|
if (maxLen < strlen(dir) + 1)
|
||||||
|
return HGBASE_ERR_FAIL;
|
||||||
|
strcpy(name, dir);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Dl_info dlinfo;
|
||||||
|
if (0 == dladdr(addr, &dlinfo))
|
||||||
|
return HGBASE_ERR_FAIL;
|
||||||
|
if (maxLen < strlen(dlinfo.dli_fname) + 1)
|
||||||
|
return HGBASE_ERR_FAIL;
|
||||||
|
strcpy(name, dlinfo.dli_fname);
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
HMODULE hModule = NULL;
|
HMODULE hModule = NULL;
|
||||||
GetModuleHandleExA(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS
|
GetModuleHandleExA(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS
|
||||||
| GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, (LPCSTR)addr, &hModule);
|
| GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, (LPCSTR)addr, &hModule);
|
||||||
if (NULL == hModule)
|
|
||||||
return HGBASE_ERR_FAIL;
|
|
||||||
|
|
||||||
CHAR moduleName[MAX_PATH] = { 0 };
|
CHAR moduleName[MAX_PATH] = { 0 };
|
||||||
DWORD len = GetModuleFileNameA(hModule, moduleName, MAX_PATH);
|
DWORD len = GetModuleFileNameA(hModule, moduleName, MAX_PATH);
|
||||||
|
@ -253,6 +264,32 @@ HGResult HGAPI HGBase_GetConfigPath(HGChar* configPath, HGUInt maxLen)
|
||||||
return HGBASE_ERR_INVALIDARG;
|
return HGBASE_ERR_INVALIDARG;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HGChar moduleName[256];
|
||||||
|
HGBase_GetModuleName(NULL, moduleName, 256);
|
||||||
|
HGChar modulePath[256];
|
||||||
|
HGBase_GetFilePath(moduleName, modulePath, 256);
|
||||||
|
strcat(modulePath, "first.cfg");
|
||||||
|
|
||||||
|
HGChar dataPath[256] = {0};
|
||||||
|
HGBase_GetProfileString(modulePath, "constraints", "local_data_path", "", dataPath, 256);
|
||||||
|
if ('\0' != *dataPath)
|
||||||
|
{
|
||||||
|
#if defined(HG_CMP_MSC)
|
||||||
|
if (dataPath[strlen(dataPath) - 1] != '\\')
|
||||||
|
strcat(dataPath, "\\");
|
||||||
|
strcat(dataPath, "Cfg\\");
|
||||||
|
#else
|
||||||
|
if (dataPath[strlen(dataPath) - 1] != '/')
|
||||||
|
strcat(dataPath, "/");
|
||||||
|
strcat(dataPath, "Cfg/");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (maxLen < strlen(dataPath) + 1)
|
||||||
|
return HGBASE_ERR_FAIL;
|
||||||
|
strcpy(configPath, dataPath);
|
||||||
|
return HGBASE_ERR_OK;
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(HG_CMP_MSC)
|
#if defined(HG_CMP_MSC)
|
||||||
CHAR cfgPath[MAX_PATH] = { 0 };
|
CHAR cfgPath[MAX_PATH] = { 0 };
|
||||||
BOOL ret = SHGetSpecialFolderPathA(NULL, cfgPath, CSIDL_APPDATA, FALSE);
|
BOOL ret = SHGetSpecialFolderPathA(NULL, cfgPath, CSIDL_APPDATA, FALSE);
|
||||||
|
@ -291,6 +328,32 @@ HGResult HGAPI HGBase_GetLogFilePath(HGChar* logFilePath, HGUInt maxLen)
|
||||||
return HGBASE_ERR_INVALIDARG;
|
return HGBASE_ERR_INVALIDARG;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HGChar moduleName[256];
|
||||||
|
HGBase_GetModuleName(NULL, moduleName, 256);
|
||||||
|
HGChar modulePath[256];
|
||||||
|
HGBase_GetFilePath(moduleName, modulePath, 256);
|
||||||
|
strcat(modulePath, "first.cfg");
|
||||||
|
|
||||||
|
HGChar dataPath[256] = { 0 };
|
||||||
|
HGBase_GetProfileString(modulePath, "constraints", "local_data_path", "", dataPath, 256);
|
||||||
|
if ('\0' != *dataPath)
|
||||||
|
{
|
||||||
|
#if defined(HG_CMP_MSC)
|
||||||
|
if (dataPath[strlen(dataPath) - 1] != '\\')
|
||||||
|
strcat(dataPath, "\\");
|
||||||
|
strcat(dataPath, "Cfg\\");
|
||||||
|
#else
|
||||||
|
if (dataPath[strlen(dataPath) - 1] != '/')
|
||||||
|
strcat(dataPath, "/");
|
||||||
|
strcat(dataPath, "Cfg/");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (maxLen < strlen(dataPath) + 1)
|
||||||
|
return HGBASE_ERR_FAIL;
|
||||||
|
strcpy(logFilePath, dataPath);
|
||||||
|
return HGBASE_ERR_OK;
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(HG_CMP_MSC)
|
#if defined(HG_CMP_MSC)
|
||||||
CHAR logPath[MAX_PATH] = { 0 };
|
CHAR logPath[MAX_PATH] = { 0 };
|
||||||
BOOL ret = SHGetSpecialFolderPathA(NULL, logPath, CSIDL_APPDATA, FALSE);
|
BOOL ret = SHGetSpecialFolderPathA(NULL, logPath, CSIDL_APPDATA, FALSE);
|
||||||
|
|
|
@ -108,4 +108,4 @@ int cgiMain()
|
||||||
//打印输出
|
//打印输出
|
||||||
fprintf(cgiOut, "<p> upload file success. </p>\n");
|
fprintf(cgiOut, "<p> upload file success. </p>\n");
|
||||||
return cgiFormSuccess;
|
return cgiFormSuccess;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue