int main(int argc, char **argv) { /* Initialize subsystems */ Sys_Init(); /* Set video mode */ Video_SetMode(); /* Initialize console */ Gui_InitConsole(); /* Draw background */ Gui_DrawBackground(); /* Initialize Wiimote */ Wpad_Init(); /* Print disclaimer */ Disclaimer(); /* Menu loop */ Menu_Loop(); /* Restart Wii */ Restart_Wait(); return 0; }
//------------------Main function------------------------------- int main() { Disclaimer(); //put da code here CleanInput(); return 0; }
int _tmain(int argc, _TCHAR* argv[]) { ARGUMENTS params = { 0 }; // Parsed program arguments HANDLE hInDev = NULL; HANDLE hOutDev = NULL; // Disk Geometry LONGLONG DiskSize = { 0 }; // disk size in bytes DWORD SectorSize; // Physical sector size std::queue <LPVOID> cola; // Thread synchronization HANDLE hMutex; HANDLE hThread[2] = { 0 }; DWORD ThreadID[2] = { 0 }; if (!ParseProgramArguments(¶ms, argc, argv)) { return 1; } BQUEUE data = { &cola, 0}; // data queue #if (_WIN32_WINNT >= _WIN32_WINNT_VISTA) HANDLE hToken; OpenProcessToken(GetCurrentProcess(), TOKEN_READ, &hToken); DWORD infoLen; TOKEN_ELEVATION elevation; GetTokenInformation(hToken, TokenElevation, &elevation, sizeof(elevation), &infoLen); if (!elevation.TokenIsElevated) { wprintf(L"This program must run in elevated mode\n"); return -1; } #else #error you are using an old version of sdk or not supported operating system #endif if (!OpenDescriptors(params.sInDev, params.sOutDev, &hInDev, &hOutDev)) { return -1; } if (!GetDescriptorGeometry(hInDev, &SectorSize, &DiskSize)) { return -1; } /* Mutex Creation */ hMutex = CreateMutex(NULL, FALSE, NULL); if (hMutex == NULL) { wprintf(L"CreateMutex() error: %d\n", GetLastError()); return -1; } /* The party start now */ wprintf(L">>> windd %s - By Luis Gonzalez Fernandez\n", VERSION); if (!params.NoDisclaimer) Disclaimer(); wprintf(L"%s => %s\n", params.sInDev, params.sOutDev); /* Reader Thread */ TPARAMS ReaderParams = { 0 }; ReaderParams.hDev = hInDev; ReaderParams.cola = &data; ReaderParams.StartOffset = params.dwSkip; // skip n bytes at input ReaderParams.EndOffset = DiskSize; if (params.dwInBs) ReaderParams.SectorSize = params.dwInBs; else ReaderParams.SectorSize = SectorSize; ReaderParams.MemBuff = params.dwBuff; ReaderParams.Mutex = hMutex; ReaderParams.DiskSize = DiskSize; ReaderParams.DataProcessed = 0; ReaderParams.Verbose = params.Verbose; hThread[0] = CreateThread(NULL, 0, ReadSect, &ReaderParams, 0, &ThreadID[0]); /* Writer Thread */ TPARAMS WriterParams = { 0 }; WriterParams.hDev = hOutDev; WriterParams.cola = &data; WriterParams.StartOffset = params.dwSeek; // seek until this offset at write. WriterParams.EndOffset = (DiskSize + params.dwSeek - params.dwSkip); if (params.dwOutBs) WriterParams.SectorSize = params.dwOutBs; else WriterParams.SectorSize = SectorSize; WriterParams.Mutex = hMutex; WriterParams.DiskSize = DiskSize; WriterParams.DataProcessed = 0; WriterParams.Verbose = params.Verbose; hThread[1] = CreateThread(NULL, 0, WriteSect, &WriterParams, 0, &ThreadID[1]); WaitForMultipleObjects(2, hThread, TRUE, INFINITE); if (ReaderParams.DataProcessed == WriterParams.DataProcessed) wprintf(L"Done!\n"); else wprintf(L"Error, %lu bytes are not copied.\n", (ReaderParams.DataProcessed - WriterParams.DataProcessed)); CloseHandle(hInDev); CloseHandle(hOutDev); return 0; }
void CCardView::OnCardServer() { // Some configurations do not support online greetings ("card server"). if (!GetConfiguration()->SupportsCardServer()) { return; } // Get our document. CPmwDoc* pDoc = GetDocument(); if(GetGlobalContentManager()->CheckAccountStatus()) { CString strID = GetGlobalContentManager()->GetAccountID(); if(strID != "") { // Put up the card server dialog. CCardServerDialog Dialog(this); Dialog.m_ctTime = CTime::GetCurrentTime(); if (Dialog.DoModal() == IDOK) { // Put up the disclaimer dialog. CCardServerDisclaimer Disclaimer(this); if (Disclaimer.DoModal() == IDOK) { // Create the directory we want to use as our FTP source. CString csDir = pDoc->GetPathManager()->ExpandPath("[[U]]\\NETCARD"); if (!Util::MakeDirectory(csDir)) { // Not able to make the directory. // LPCSTR pFormat = "Can't create the directory\n%s"; LPCSTR pFormat = GET_PMWAPP()->GetResourceStringPointer(IDS_ErrCreateDirectory); CString csMessage; csMessage.Format(pFormat, (LPCSTR)csDir); AfxMessageBox(csMessage); return; } // Construct the text file. CString csTextFile; Util::ConstructPath(csTextFile, csDir, "INFO.INI"); CFile cfText; CString csVersion; CString csPPN; TRY { CFileException e; //if (!cfText.Open(csTextFile, // CFile::modeCreate // | CFile::modeWrite, // &e)) //{ // AfxThrowFileException(e.m_cause, e.m_lOsError); //} //do the time stuff //time zone difference from PST struct _timeb tstruct; _ftime( &tstruct ); int timecorrection = PacificTimeCorrection(tstruct.timezone); //get date of delivery - include current time struct tm when; CString strDate; CTime testtime = CTime::GetCurrentTime(); when = *testtime.GetLocalTm(NULL); SYSTEMTIME sysTime = *Dialog.GetTime(); if((when.tm_mday != sysTime.wDay) || (when.tm_mon != (sysTime.wMonth - 1))) { when.tm_mday = sysTime.wDay; when.tm_mon = sysTime.wMonth - 1; ConvertToPST(&when, timecorrection); CString str_ampm = "AM"; if( when.tm_hour > 12 ) /* Set up extension. */ str_ampm = "PM"; if( when.tm_hour > 12 ) /* Convert from 24-hour */ when.tm_hour -= 12; /* to 12-hour clock. */ if( when.tm_hour == 0 ) /*Set hour to 12 if midnight. */ when.tm_hour = 12; strDate.Format("%d/%d/%d %d:%d:%d%s", (int)((int)when.tm_mon + 1),when.tm_mday,when.tm_year,when.tm_hour,when.tm_min,when.tm_sec,str_ampm); } else { strDate = ""; } CString strPSTCorrection; strPSTCorrection.Format("%d", timecorrection); // Construct the version string. CString csEol = "\r\n"; csVersion = GetConfiguration()->ReplacementText('T'); csVersion += ' '; csVersion += GET_PMWAPP()->GetVersion(); csPPN = GET_PMWAPP()->GetParentPartNumber(); WritePrivateProfileString( "UserData", "UserId", GetGlobalContentManager()->GetAccountID(), csTextFile); WritePrivateProfileString( "UserData", "Description", csVersion, csTextFile); WritePrivateProfileString( "UserData", "SenderEmail", Dialog.m_csFrom, csTextFile); WritePrivateProfileString( "UserData", "RecipientEmail", Dialog.m_csTo, csTextFile); WritePrivateProfileString( "UserData", "sku", csPPN, csTextFile); WritePrivateProfileString( "CardData", "Title", Dialog.m_csTitle, csTextFile); WritePrivateProfileString( "CardData", "Date", strDate, csTextFile); WritePrivateProfileString( "CardData", "Offset", strPSTCorrection, csTextFile); #if 0 // Write version cfText.Write(csVersion, csVersion.GetLength()); cfText.Write(csEol, csEol.GetLength()); // Write "from" email address cfText.Write(Dialog.m_csFrom, Dialog.m_csFrom.GetLength()); cfText.Write(csEol, csEol.GetLength()); // Write "to" email address cfText.Write(Dialog.m_csTo, Dialog.m_csTo.GetLength()); cfText.Write(csEol, csEol.GetLength()); // Write Parent Part Number cfText.Write(csPPN, csPPN.GetLength()); cfText.Write(csEol, csEol.GetLength()); #endif //cfText.Close(); } CATCH_ALL(e) { // Could not write the text file. Complain. // LPCSTR pFormat = "Can't create the file\n%s"; LPCSTR pFormat = GET_PMWAPP()->GetResourceStringPointer(IDS_ErrCreateFile); CString csMessage; csMessage.Format(pFormat, (LPCSTR)csTextFile); AfxMessageBox(csMessage); return; } END_CATCH_ALL // Figure out how big we want the panels to be. CPoint cpFrontDims; CPoint cpInsideDims; PBOX World; pDoc->get_panel_world(&World, CARD_PANEL_Front); // Fit the front panel into a 425x425 square. PPNT FrontDims; FrontDims.x = World.x1 - World.x0; FrontDims.y = World.y1 - World.y0; double dScale = 425.0/(double)FrontDims.x; double dYScale = 425.0/(double)FrontDims.y; if (dScale > dYScale) dScale = dYScale; cpFrontDims.x = (int)((double)FrontDims.x*dScale); cpFrontDims.y = (int)((double)FrontDims.y*dScale); pDoc->get_panel_world(&World, CARD_PANEL_Inside); cpInsideDims.x = (int)((double)(World.x1-World.x0)*dScale); cpInsideDims.y = (int)((double)(World.y1-World.y0)*dScale); TRACE("Front: %d, %d; Inside: %d, %d\n", cpFrontDims.x, cpFrontDims.y, cpInsideDims.x, cpInsideDims.y); BOOL fSuccess = FALSE; CCardServerProgressDialog ProgressDialog(AfxGetMainWnd()); CString csName; Util::ConstructPath(csName, csDir, "front.gif"); ProgressDialog.SetStatus(IDS_BuildingFront); if (DumpPanel(CARD_PANEL_Front, csName, cpFrontDims)) { ProgressDialog.SetStatus(IDS_BuildingInside); Util::ConstructPath(csName, csDir, "inside.gif"); if(DumpPanel(CARD_PANEL_Inside, csName, cpInsideDims)) fSuccess = TRUE; } if (!fSuccess) { // "Can't create card pictures." AfxMessageBox(GET_PMWAPP()->GetResourceStringPointer(IDS_ErrWriteCardPictures)); return; } // Now, invoke the DLL to write the data. CCardServerDLL DLL; #ifdef WIN32 CString csDLLName = pDoc->GetPathManager()->ExpandPath("FTP32.DLL"); #else CString csDLLName = pDoc->GetPathManager()->ExpandPath("FTP16.DLL"); #endif // Startup the dialog. if (DLL.Startup(csDLLName)) { if(CheckForValidConnection()){ // Put up our progress dialog. // Send the files. int nResult = DLL.SendFiles(csDir, ProgressDialog); // Take down the progress dialog now. ProgressDialog.DestroyWindow(); // Shut down the DLL. DLL.Shutdown(); CPmwDialog Dialog(nResult == 0 ? IDD_CARD_SERVER_SUCCESS : IDD_CARD_SERVER_FAILURE); Dialog.DoModal(); } } else { // Not able to load the DLL. Complain. // LPCSTR pFormat = "The file\n%s\nis missing or bad."; LPCSTR pFormat = GET_PMWAPP()->GetResourceStringPointer(IDS_ErrMissingDLL); CString csMessage; csMessage.Format(pFormat, (LPCSTR)csDLLName); AfxMessageBox(csMessage); } }