11#pragma message(__FILE__": Compiled as C++ for testing purpose.")
14#define WIN32_LEAN_AND_MEAN
15#define _CRTDBG_MAP_ALLOC
22#ifndef INVALID_FILE_ATTRIBUTES
23#define INVALID_FILE_ATTRIBUTES ((DWORD)-1)
50#define OPERATION_ASK 0
51#define OPERATION_QUIT 1
52#define OPERATION_FORCE 2
57#define TARGET_NONE (ULONG)-1
91 {
"INSTALL", 2,
Install, MSG_HINT_INSTALL},
92 {
"REMOVE", 1,
Remove, MSG_HINT_REMOVE },
93 {
"CONFIG", 1,
Config, MSG_HINT_CONFIG },
94 {
"START", 0,
Start, MSG_HINT_START },
95 {
"STOP", 1,
Stop, MSG_HINT_STOP },
96 {
"SHELL", 1,
Shell, MSG_HINT_SHELL },
97 {
"OPEN", 6,
Open, MSG_HINT_OPEN },
98 {
"CLOSE", 2,
Close, MSG_HINT_CLOSE },
99 {
"SAVE", 3,
Save, MSG_HINT_SAVE, },
100 {
"PROTECT", 2,
Protect, MSG_HINT_PROTECT},
101 {
"FORMAT", 2,
Format, MSG_HINT_FORMAT },
102 {
"LINK", 3,
Link, MSG_HINT_LINK },
103 {
"ULINK", 1,
Unlink, MSG_HINT_ULINK },
104 {
"STATUS", 0,
Status, MSG_HINT_STATUS },
105 {
"HELP", 1,
Help, MSG_HELP_HELP },
106 {
"?", 1,
Help, MSG_HELP_HELP },
107 {
"VERSION", 0,
Version, MSG_HINT_VERSION},
119 {
"GENERAL", MSG_HELP_GENERAL},
120 {
"CONSOLE", MSG_HELP_CONSOLE},
121 {
"INSTALL", MSG_HELP_INSTALL},
122 {
"REMOVE", MSG_HELP_REMOVE },
123 {
"CONFIG", MSG_HELP_CONFIG },
124 {
"START", MSG_HELP_START },
125 {
"STOP", MSG_HELP_STOP },
126 {
"SHELL", MSG_HELP_SHELL },
127 {
"OPEN", MSG_HELP_OPEN },
128 {
"CLOSE", MSG_HELP_CLOSE },
129 {
"SAVE", MSG_HELP_SAVE },
130 {
"PROTECT", MSG_HELP_PROTECT},
131 {
"FORMAT", MSG_HELP_FORMAT },
132 {
"LINK", MSG_HELP_LINK },
133 {
"ULINK", MSG_HELP_ULINK },
134 {
"STATUS", MSG_HELP_STATUS },
135 {
"HELP", MSG_HELP_HELP },
136 {
"VERSION", MSG_HINT_VERSION},
159#define IS_WINDOWS_NT() ((GetVersion() & 0xff) < 5)
174 printf(
"\r\n VFD.EXE Command Reference\r\n");
181 "====================\r\n"
183 "====================\r\n"
283 while (*
p ==
' ' || *
p ==
'\t' || *
p ==
'\n') {
306 else if (*
p ==
'.') {
327 if (*
p ==
'\"' || *
p ==
'\'') {
336 while (*
p && *
p !=
'\n') {
338 if (*
p ==
'\t' || *
p ==
' ') {
358 while (*
p ==
' ' || *
p ==
'\t' || *
p ==
'\n') {
401 if (*
p ==
'\"' || *
p ==
'\'') {
419 while (
i <
argc - 1) {
449 *(
args[0] + 1) ==
':' &&
450 *(
args[0] + 2) ==
'\0') {
455 *(
args[0] + 2) =
'\\';
456 *(
args[0] + 3) =
'\0';
537 const char *install_path =
NULL;
588 else if (**
args ==
'/') {
599 install_path = *
args;
651 const char *stop_params[] = {
NULL,
NULL };
668 stop_params[0] = *
args;
679 stop_params[0] = *
args;
905 const char *close_params[] = {
"*",
NULL,
NULL };
920 close_params[1] = *
args;
933 close_params[1] = *
args;
1095 CHAR protect =
'\0';
1283 *(*
args + 1) ==
':' &&
1284 *(*
args + 2) ==
'\0') {
1296 else if (**
args !=
'/') {
1343 InputChar(MSG_CREATE_CONFIRM,
"yn") ==
'n') {
1364 InputChar(MSG_OVERWRITE_CONFIRM,
"yn") ==
'n') {
1393 InputChar(MSG_CREATE144_CONFIRM,
"yn") ==
'n') {
1473 if (
InputChar(MSG_MEDIATYPE_CONFIRM,
"yn") ==
'n') {
1479 media_type = def_media;
1497 InputChar(MSG_RAM_MODE_CONFIRM,
"yn") ==
'n') {
1528 InputChar(MSG_CREATE144_CONFIRM,
"yn") ==
'n') {
1537 if (protect ==
'P') {
1544 media_type = (
VFD_MEDIA)(media_type + 1);
1599 disk_type, media_type, media_flags);
1674 (*(*
args + 1) ==
':' || *(*
args + 1) ==
'\0')) {
1681 if (**
args ==
'*') {
1687 target_max = target_min + 1;
1722 while (target_min < target_max) {
1745 &media_type, &media_flags,
NULL,
NULL);
1785 if (
InputChar(MSG_CLOSE_CONFIRM,
"yn") ==
'n') {
1812 c =
InputChar(MSG_RETRY_FORCE_CANCEL,
"rfc");
1818 else if (
c ==
'c') {
1895 if (truncate || overwrite) {
1905 if (truncate || overwrite) {
1913 *(*
args + 1) ==
':' &&
1914 *(*
args + 2) ==
'\0') {
1923 else if (**
args ==
'/') {
1974 &media_type, &media_flags,
NULL,
NULL);
2025 if (!overwrite && !truncate) {
2047 else if (
c ==
't') {
2092 int c =
InputChar(MSG_RETRY_FORCE_CANCEL,
"rfc");
2097 else if (
c ==
'f') {
2113 (overwrite || truncate), truncate);
2134#define PROTECT_NONE 0
2136#define PROTECT_OFF 2
2374 int c =
InputChar(MSG_RETRY_FORCE_CANCEL,
"rfc");
2379 else if (
c ==
'f') {
2436 if (**
args ==
'*') {
2441 target_min = **
args;
2442 target_max = target_min + 1;
2488 while (target_min < target_max) {
2512 if (letters &&
isalpha(*letters)) {
2558 (*(*
args + 1) ==
':' || *(*
args + 1) ==
'\0')) {
2565 if (**
args ==
'*') {
2570 target_min = **
args;
2571 target_max = target_min + 1;
2610 while (target_min < target_max) {
2703 (
version & 0x80000000) ?
"(debug)" :
"");
2715 switch (start_type) {
2829 msg = MSG_HELP_HELP;
2862 "http://chitchat.at.infoseek.co.jp/vmware/vfd.html\n");
2872#define CMD_MATCH_NONE -1
2873#define CMD_MATCH_MULTI -2
2935 if (*
topic ==
'\0') {
3033 input.Event.KeyEvent.bKeyDown) {
3037 if (
strchr(ans, reply)) {
3054 ULONG device_number;
3073 device_number = (
ULONG)-1;
3166 static int rows = 0;
3192 if (bReset || rows <= 0) {
3193 rows =
info.srWindow.Bottom -
info.srWindow.Top - 1;
3196 cols =
info.dwSize.X;
3213 if (*(
cur++) ==
'\n' || (cols--) == 0) {
3223 cols =
info.dwSize.X;
3241 if (prompt_len == 0) {
3246 NULL, MSG_PAGER_PROMPT, 0,
3247 prompt,
sizeof(prompt),
NULL);
3249 if (prompt_len == 0) {
3250 strcpy(prompt,
"Press any key to continue...");
3251 prompt_len =
strlen(prompt);
3280 info.dwCursorPosition.X =
3281 (
short)(
info.dwCursorPosition.X + prompt_len);
3293 !
input.Event.KeyEvent.bKeyDown ||
3294 !
input.Event.KeyEvent.uChar.AsciiChar);
3298 info.dwCursorPosition.X =
3299 (
short)(
info.dwCursorPosition.X - prompt_len);
3321 tolower(
input.Event.KeyEvent.uChar.AsciiChar) ==
'q') {
3370 static char msg[256];
3417 else if (*
src ==
'\\' || *
src ==
'/') {
3421 if ((*(
src + 1) ==
'\\' || *(
src + 1) ==
'/') &&
3422 *(
src + 2) && *(
src + 2) !=
'\\' && *(
src + 2) !=
'/') {
3430 while (*
src && *
src !=
'\\' && *
src !=
'/') {
3443 while (*
src ==
'\\' || *
src ==
'/') {
3455 while (*
q && *
q !=
'\\' && *
q !=
'/') {
3468 else if ((
q -
src) > 1 || *
src !=
'.') {
3475 *(
p + (
q -
src)) =
'\0';
3492 while (*
q ==
'\\' || *
q ==
'/') {
int strcmp(const char *String1, const char *String2)
ACPI_SIZE strlen(const char *String)
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
char * strcpy(char *DstString, const char *SrcString)
char * strncpy(char *DstString, const char *SrcString, ACPI_SIZE Count)
char * strchr(const char *String, int ch)
BOOL WINAPI FlushConsoleInputBuffer(IN HANDLE hConsoleInput)
BOOL WINAPI SetConsoleCursorPosition(IN HANDLE hConsoleOutput, IN COORD dwCursorPosition)
HANDLE WINAPI GetStdHandle(IN DWORD nStdHandle)
BOOL WINAPI FillConsoleOutputAttribute(IN HANDLE hConsoleOutput, IN WORD wAttribute, IN DWORD nLength, IN COORD dwWriteCoord, OUT LPDWORD lpNumberOfAttrsWritten)
BOOL WINAPI GetConsoleScreenBufferInfo(IN HANDLE hConsoleOutput, OUT PCONSOLE_SCREEN_BUFFER_INFO lpConsoleScreenBufferInfo)
#define _CRTDBG_LEAK_CHECK_DF
#define _CRTDBG_REPORT_FLAG
#define _CrtSetDbgFlag(f)
#define INVALID_HANDLE_VALUE
#define _strnicmp(_String1, _String2, _MaxCount)
#define ERROR_ACCESS_DENIED
static const WCHAR version[]
BOOL WINAPI GetConsoleMode(HANDLE hConsoleHandle, LPDWORD lpMode)
BOOL WINAPI DECLSPEC_HOTPATCH SetConsoleMode(HANDLE hConsoleHandle, DWORD dwMode)
BOOL WINAPI DECLSPEC_HOTPATCH SetConsoleCtrlHandler(PHANDLER_ROUTINE HandlerRoutine, BOOL Add)
BOOL WINAPI FindClose(HANDLE hFindFile)
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
GLdouble GLdouble GLdouble GLdouble q
GLenum GLuint GLenum GLsizei const GLchar * buf
GLenum GLenum GLenum input
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
HLOCAL NTAPI LocalFree(HLOCAL hMem)
_Check_return_ _CRTIMP int __cdecl isalnum(_In_ int _C)
_Check_return_opt_ _CRTIMP int __cdecl fflush(_Inout_opt_ FILE *_File)
_Check_return_opt_ _CRTIMP char *__cdecl fgets(_Out_writes_z_(_MaxCount) char *_Buf, _In_ int _MaxCount, _Inout_ FILE *_File)
_In_opt_ PVOID _Out_ BOOLEAN * Stop
static GLint image_size(GLint width, GLint height, GLenum format, GLenum type)
struct task_struct * current
#define ERROR_FILE_NOT_FOUND
#define sprintf(buf, format,...)
static unsigned int number
static const struct access_res create[16]
#define FILE_ATTRIBUTE_READONLY
#define FILE_ATTRIBUTE_COMPRESSED
#define UNREFERENCED_PARAMETER(P)
#define FILE_ATTRIBUTE_ENCRYPTED
static const char topic[]
int __cdecl system(_In_opt_z_ const char *_Command)
FD_TYPE file_type(FDSC **curr, char *fixed)
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
VFD_MEDIA WINAPI VfdLookupMedia(ULONG nSize)
DWORD WINAPI VfdCheckHandlers()
ULONG WINAPI VfdGetMediaSize(VFD_MEDIA nMediaType)
DWORD WINAPI VfdSetLocalLink(HANDLE hDevice, CHAR cLetter)
DWORD WINAPI VfdFormatMedia(HANDLE hDevice)
DWORD WINAPI VfdUnregisterHandlers()
DWORD WINAPI VfdWriteProtect(HANDLE hDevice, BOOL bProtect)
DWORD WINAPI VfdStopDriver(PDWORD pState)
DWORD WINAPI VfdSaveImage(HANDLE hDevice, PCSTR sFileName, BOOL bOverWrite, BOOL bTruncate)
DWORD WINAPI VfdGetDriverState(PDWORD pState)
DWORD WINAPI VfdRemoveDriver()
CHAR WINAPI VfdChooseLetter()
#define VFD_NOT_INSTALLED
DWORD WINAPI VfdGetGlobalLink(HANDLE hDevice, PCHAR pLetter)
void WINAPI VfdMakeFileDesc(PSTR pBuffer, ULONG nBufSize, VFD_FILETYPE nFileType, ULONG nFileSize, DWORD nFileAttr)
DWORD WINAPI VfdGetImageInfo(HANDLE hDevice, PSTR sFileName, PVFD_DISKTYPE pDiskType, PVFD_MEDIA pMediaType, PVFD_FLAGS pMediaFlags, PVFD_FILETYPE pFileType, PULONG pImageSize)
DWORD WINAPI VfdInstallDriver(PCSTR sFileName, DWORD nStart)
HANDLE WINAPI VfdOpenDevice(ULONG nTarget)
DWORD WINAPI VfdDismountVolume(HANDLE hDevice, BOOL bForce)
DWORD WINAPI VfdGetLocalLink(HANDLE hDevice, PCHAR pLetter)
DWORD WINAPI VfdGetMediaState(HANDLE hDevice)
DWORD WINAPI VfdCheckDriverFile(PCSTR sFileName, PULONG pFileVersion)
DWORD WINAPI VfdGetDriverVersion(HANDLE hDevice, PULONG pVersion)
PCSTR WINAPI VfdMediaTypeName(VFD_MEDIA nMediaType)
DWORD WINAPI VfdGetDriverConfig(PSTR sFileName, PDWORD pStart)
DWORD WINAPI VfdCheckImageFile(PCSTR sFileName, PDWORD pAttributes, PVFD_FILETYPE pFileType, PULONG pImageSize)
DWORD WINAPI VfdGetDeviceNumber(HANDLE hDevice, PULONG pNumber)
DWORD WINAPI VfdCreateImageFile(PCSTR sFileName, VFD_MEDIA nMediaType, VFD_FILETYPE nFileType, BOOL bOverWrite)
BOOL WINAPI VfdIsValidPlatform()
DWORD WINAPI VfdRegisterHandlers()
DWORD WINAPI VfdStartDriver(PDWORD pState)
DWORD WINAPI VfdConfigDriver(DWORD nStart)
DWORD WINAPI VfdSetGlobalLink(HANDLE hDevice, CHAR cLetter)
static const char * SystemError(DWORD err)
static const struct @1539 Commands[]
static int Link(const char **args)
static int InputChar(ULONG msg, PCSTR ans)
static void PrintMessage(UINT msg,...)
static int Save(const char **args)
static int Unlink(const char **args)
static DWORD driver_state
static void ConvertPathCase(char *src, char *dst)
static int InteractiveConsole()
int(* cmdfnc)(const char **args)
static int ProcessCommandLine(int argc, const char **args)
static int ParseCommand(const char *cmd)
static int Shell(const char **args)
static void PrintImageInfo(HANDLE hDevice)
static const struct @1540 HelpMsg[]
static void PrintDriveLetter(HANDLE hDevice, ULONG nDrive)
static int ParseHelpTopic(const char *topic)
static const char * help_progname
static BOOL ConsolePager(char *pBuffer, BOOL bReset)
static int Install(const char **args)
VOID VfdCloseImage(IN PDEVICE_EXTENSION DeviceExtension)
NTSTATUS VfdOpenImage(IN PDEVICE_EXTENSION DeviceExtension, IN PVFD_IMAGE_INFO ImageInfo)
#define VFD_MAXIMUM_DEVICES
#define VFD_FLAG_DATA_MODIFIED
#define VFD_FLAG_WRITE_PROTECTED
#define VFD_COPYRIGHT_STR
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_CHILD_LIST_CONFIG Config
_Must_inspect_result_ _In_ WDFDEVICE _In_ LPCGUID _Out_ PINTERFACE _In_ USHORT _In_ USHORT Version
#define STD_OUTPUT_HANDLE
DWORD WINAPI GetLastError(void)
#define GetFileAttributes
#define SetCurrentDirectory
#define FORMAT_MESSAGE_IGNORE_INSERTS
#define FORMAT_MESSAGE_FROM_SYSTEM
#define FORMAT_MESSAGE_ALLOCATE_BUFFER
#define FORMAT_MESSAGE_ARGUMENT_ARRAY
#define FORMAT_MESSAGE_FROM_HMODULE
#define GetCurrentDirectory
#define WriteConsoleOutputCharacter
#define ENABLE_PROCESSED_INPUT
#define COMMON_LVB_REVERSE_VIDEO
#define FillConsoleOutputCharacter
#define ERROR_PATH_NOT_FOUND
#define ERROR_WRITE_PROTECT
#define ERROR_FILE_EXISTS
#define SERVICE_STOP_PENDING
#define SERVICE_START_PENDING
#define SERVICE_PAUSE_PENDING
#define SERVICE_CONTINUE_PENDING
#define SERVICE_DEMAND_START
#define SERVICE_AUTO_START
#define SERVICE_BOOT_START
#define SERVICE_SYSTEM_START
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID _In_ ULONG_PTR _In_ SIZE_T _Inout_opt_ PLARGE_INTEGER _Inout_ PSIZE_T _In_ SECTION_INHERIT _In_ ULONG _In_ ULONG Protect