int main() { PROCESS_INFORMATION piProcInfo; STARTUPINFO siStartInfo; char cmdline[1024]; char programfile[1024]; /* Only one invocation allowed. */ /* check if we are already running. */ if (CheckIfRunning()) { MessageBox(NULL, "An Install is already in progress. Aborting Install.", "KeyTrans Installation", MB_OK); exit(-1); } if (GetProgramFilesPath(programfile, 1024) == 0) { MessageBox(NULL, "Couldnt obtain Program Files Directory path. - Aborting Install.", "KeyTrans Installation", MB_OK); /* Destroy the Semaphore. */ CloseHandle(OnlyOneSem); exit(-1); } strcat(programfile, "\\KeyTrans"); #ifdef DEBUG fprintf(stdout, "Program Files Path: %s\n", programfile); #endif /* We have programfile as: "C:\Program Files" */ /* Install it and quit. */ if (InstallFiles(programfile) == 1) { #ifdef DEBUG fprintf(stdout, "Installed KeyTrans.\n"); #endif ShowInstallDir(programfile); MessageBox(NULL, "KeyTrans Installed successfully. Please install the Vutam Font.", "KeyTrans Installation", MB_OK); } else { MessageBox(NULL, "KeyTrans Installation Failed.", "KeyTrans Installation", MB_OK); /* Destroy the Semaphore. */ CloseHandle(OnlyOneSem); exit(-1); } /* Destroy the Semaphore. */ CloseHandle(OnlyOneSem); /* and we exit. */ exit(0); }
CDialog::CDialog(HINSTANCE hInstance, int nCmdShow, bool bUnInstall) { // m_bCleanup = bUnInstall; m_bCleanup = false; m_hInstance = hInstance; m_bUnInstall = bUnInstall; m_bNewVersion = false; GetProgramFilesPath(m_szDestinationPath); lstrcat(m_szDestinationPath, "\\"); lstrcat(m_szDestinationPath, FOLDER_NAME); ::GetTempPath(MAX_PATH, m_szTempPath); ::GetModuleFileName(NULL, m_szModulePath, MAX_PATH); HWND hwnd = ::CreateDialogParam( hInstance, MAKEINTRESOURCE(IDD_MAIN), 0, DialogProc, (LPARAM)this); if (!hwnd) { char buf[100]; wsprintf(buf, "Error x%x", ::GetLastError()); ::MessageBox(0, buf, "CreateDialog", MB_ICONEXCLAMATION | MB_OK); return; } ::SetWindowLong(hwnd, DWL_USER, (LONG)this); ::ShowWindow(hwnd, nCmdShow) ; m_hwnd = hwnd; //::SetFocus( GetDlgItem(m_hDlg, IDC_FOLDER_NAME) ); }
// Get program files bstr_t GetMpClientPath() { return GetProgramFilesPath() + L"\\Windows Defender\\MPClient.dll"; }