1 2 3 4 5 6 7 8 9 10 11 12 | SYSTEMTIME st; GetLocalTime(&st); char fname[255]; wsprintfA(fname, "./PacketDump_%d_%d_%d_%d_%d_%d.txt", st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond); HANDLE outfile = CreateFile(fname, GENERIC_WRITE, FILE_SHARE_READ, 0, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); if (outfile == INVALID_HANDLE_VALUE) { MessageBoxA(NULL, "Unable to open file.", "file Error", MB_OK|MB_ICONSTOP); use_dll = false; } CloseHandle(outfile); |