void close_printer(FILE *outfile) { LPTSTR fname; HWND hwnd; TCHAR title[100]; #ifdef UNICODE fname = UnicodeText(win_prntmp, S_ENC_DEFAULT); #else fname = win_prntmp; #endif fclose(outfile); #ifndef WGP_CONSOLE hwnd = textwin.hWndParent; #else hwnd = GetDesktopWindow(); #endif if (term->name != NULL) wsprintf(title, TEXT("gnuplot graph (%hs)"), term->name); else _tcscpy(title, TEXT("gnuplot graph")); DumpPrinter(hwnd, title, fname); #ifdef UNICODE free(fname); #endif }
void close_printer(FILE *outfile) { fclose(outfile); DumpPrinter(graphwin->hWndGraph, graphwin->Title, win_prntmp); }
void _tmain(int argc, TCHAR *argv[]) { int u = 0; // // display usage // if (argc != 3){ DisplayUsage(); return; } // // Do validation on the user input to help avoid buffer overruns. // _try{ // // argv[1] should be a null terminated string // of exactly two characters in length (not including the NULL). // if ((_T('-') != argv[1][0]) || (_T('\0') == argv[1][1]) || (_T('\0') != argv[1][2])){ DisplayUsage(); return; } // // argv[2] should have at least one non-NULL character before a NULL character. // if (_T('\0') == argv[2][0]){ DisplayUsage(); return; } // // argv[2] should not be a string of more than MAX_PATH characters. // u = 0; while (_T('\0') != argv[2][u]){ if (MAX_PATH == u){ DisplayUsage(); return; } u++; } } _except(EXCEPTION_EXECUTE_HANDLER){ DisplayUsage(); return; } _tprintf(TEXT(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n")); _tprintf(TEXT(">> SECURITY INFORMATION >>\n")); _tprintf(TEXT(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n\n")); _tprintf(TEXT("object name ........ %s\n"), argv[2]); _tprintf(TEXT("object type ........ ")); switch (argv[1][1]) { case 'a': _tprintf(TEXT("mailslot\n")); DumpKernelObject(argv[2], argv[1][1]); break; case 'e': _tprintf(TEXT("event\n")); DumpKernelObject(argv[2], argv[1][1]); break; case 'f': _tprintf(TEXT("file\n")); DumpFile(argv[2], argv[1][1]); break; case 'd': _tprintf(TEXT("directory\n")); DumpFile(argv[2], argv[1][1]); break; case 'm': _tprintf(TEXT("mutex\n")); DumpKernelObject(argv[2], argv[1][1]); break; case 'r': _tprintf(TEXT("registry\n")); DumpRegistryKey(argv[2]); break; case 's': _tprintf(TEXT("semaphore\n")); DumpKernelObject(argv[2], argv[1][1]); break; case 'p': _tprintf(TEXT("process\n")); DumpKernelObject(argv[2], argv[1][1]); break; case 'i': _tprintf(TEXT("memory mapped file\n")); DumpKernelObject(argv[2], argv[1][1]); break; case 'v': _tprintf(TEXT("service\n")); DumpService(NULL, argv[2]); break; case 'w': _tprintf(TEXT("window station\n")); DumpUserObject(argv[2], argv[1][1]); break; case 'k': _tprintf(TEXT("desktop\n")); DumpUserObject(argv[2], argv[1][1]); break; case 'n': _tprintf(TEXT("named pipe\n")); DumpKernelObject(argv[2], argv[1][1]); break; case 'o': _tprintf(TEXT("process access token\n")); DumpKernelObject(argv[2], argv[1][1]); break; case 'l': _tprintf(TEXT("printer\n")); DumpPrinter(argv[2]); break; case 't': _tprintf(TEXT("network share\n")); DumpNetShare(argv[2]); break; default: DisplayUsage(); } }