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) 24 #endif // INVALID_FILE_ATTRIBUTES 50 #define OPERATION_ASK 0 // ask user on error 51 #define OPERATION_QUIT 1 // quits on error 52 #define OPERATION_FORCE 2 // force on error 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},
114 static const struct {
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 2135 #define PROTECT_ON 1 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 ==
'/') {
static int ProcessCommandLine(int argc, const char **args)
#define ERROR_FILE_EXISTS
#define SERVICE_SYSTEM_START
static const struct @1519 Commands[]
DWORD WINAPI VfdGetDriverVersion(HANDLE hDevice, PULONG pVersion)
static int Start(const char **args)
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
BOOL WINAPI FillConsoleOutputAttribute(IN HANDLE hConsoleOutput, IN WORD wAttribute, IN DWORD nLength, IN COORD dwWriteCoord, OUT LPDWORD lpNumberOfAttrsWritten)
static int Install(const char **args)
#define SERVICE_PAUSE_PENDING
static void PrintImageInfo(HANDLE hDevice)
ACPI_SIZE strlen(const char *String)
#define UNREFERENCED_PARAMETER(P)
#define ERROR_WRITE_PROTECT
char * strncpy(char *DstString, const char *SrcString, ACPI_SIZE Count)
#define FORMAT_MESSAGE_ARGUMENT_ARRAY
static const struct @1520 HelpMsg[]
BOOL WINAPI GetConsoleMode(HANDLE hConsoleHandle, LPDWORD lpMode)
DWORD WINAPI VfdCheckHandlers()
#define INVALID_HANDLE_VALUE
BOOL WINAPI FlushConsoleInputBuffer(IN HANDLE hConsoleInput)
DWORD WINAPI GetLastError(VOID)
HANDLE WINAPI GetStdHandle(IN DWORD nStdHandle)
#define SERVICE_START_PENDING
static void ConvertPathCase(char *src, char *dst)
ULONG WINAPI VfdGetMediaSize(VFD_MEDIA nMediaType)
static int Unlink(const char **args)
DWORD WINAPI VfdCreateImageFile(PCSTR sFileName, VFD_MEDIA nMediaType, VFD_FILETYPE nFileType, BOOL bOverWrite)
_Check_return_ _CRTIMP int __cdecl isalnum(_In_ int _C)
DWORD WINAPI VfdDismountVolume(HANDLE hDevice, BOOL bForce)
static int Stop(const char **args)
static int Config(const char **args)
DWORD WINAPI VfdStartDriver(PDWORD pState)
static int Link(const char **args)
DWORD WINAPI VfdGetDeviceNumber(HANDLE hDevice, PULONG pNumber)
static int Format(const char **args)
DWORD WINAPI VfdConfigDriver(DWORD nStart)
#define sprintf(buf, format,...)
DWORD WINAPI VfdGetDriverConfig(PSTR sFileName, PDWORD pStart)
GLenum GLuint GLenum GLsizei const GLchar * buf
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
static void PrintMessage(UINT msg,...)
int main(int argc, const char **argv)
#define VFD_MAXIMUM_DEVICES
DWORD WINAPI VfdGetLocalLink(HANDLE hDevice, PCHAR pLetter)
#define VFD_FLAG_DATA_MODIFIED
#define ERROR_ACCESS_DENIED
VFD_MEDIA WINAPI VfdLookupMedia(ULONG nSize)
BOOL WINAPI DECLSPEC_HOTPATCH SetConsoleMode(HANDLE hConsoleHandle, DWORD dwMode)
static size_t double number
BOOL WINAPI DECLSPEC_HOTPATCH SetConsoleCtrlHandler(PHANDLER_ROUTINE HandlerRoutine, BOOL Add)
DWORD WINAPI VfdWriteProtect(HANDLE hDevice, BOOL bProtect)
#define FORMAT_MESSAGE_ALLOCATE_BUFFER
#define GetCurrentDirectory
#define COMMON_LVB_REVERSE_VIDEO
static int Save(const char **args)
DWORD WINAPI VfdUnregisterHandlers()
static const WCHAR version[]
DWORD WINAPI VfdRegisterHandlers()
BOOL WINAPI SetConsoleCursorPosition(IN HANDLE hConsoleOutput, IN COORD dwCursorPosition)
static int Help(const char **args)
#define SERVICE_BOOT_START
int __cdecl system(_In_opt_z_ const char *_Command)
static int Version(const char **args)
#define ERROR_FILE_NOT_FOUND
#define FORMAT_MESSAGE_FROM_SYSTEM
int(* cmdfnc)(const char **args)
DWORD WINAPI VfdSetLocalLink(HANDLE hDevice, CHAR cLetter)
BOOL WINAPI GetConsoleScreenBufferInfo(IN HANDLE hConsoleOutput, OUT PCONSOLE_SCREEN_BUFFER_INFO lpConsoleScreenBufferInfo)
#define FORMAT_MESSAGE_FROM_HMODULE
#define VFD_NOT_INSTALLED
#define _CRTDBG_REPORT_FLAG
#define _CRTDBG_LEAK_CHECK_DF
#define VFD_FLAG_WRITE_PROTECTED
static int InputChar(ULONG msg, PCSTR ans)
DWORD WINAPI VfdSetGlobalLink(HANDLE hDevice, CHAR cLetter)
static int Open(const char **args)
DWORD WINAPI VfdGetMediaState(HANDLE hDevice)
DWORD WINAPI VfdFormatMedia(HANDLE hDevice)
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
#define FILE_ATTRIBUTE_READONLY
static const char * SystemError(DWORD err)
#define _strnicmp(_String1, _String2, _MaxCount)
GLdouble GLdouble GLdouble GLdouble q
FD_TYPE file_type(FDSC **curr, char *fixed)
PCSTR WINAPI VfdMediaTypeName(VFD_MEDIA nMediaType)
DWORD WINAPI VfdGetGlobalLink(HANDLE hDevice, PCHAR pLetter)
DWORD WINAPI VfdGetDriverState(PDWORD pState)
#define FILE_ATTRIBUTE_COMPRESSED
static int Remove(const char **args)
static int Status(const char **args)
static int Shell(const char **args)
VOID VfdCloseImage(IN PDEVICE_EXTENSION DeviceExtension)
#define STD_OUTPUT_HANDLE
HANDLE WINAPI VfdOpenDevice(ULONG nTarget)
#define FillConsoleOutputCharacter
#define GetFileAttributes
DWORD WINAPI VfdGetImageInfo(HANDLE hDevice, PSTR sFileName, PVFD_DISKTYPE pDiskType, PVFD_MEDIA pMediaType, PVFD_FLAGS pMediaFlags, PVFD_FILETYPE pFileType, PULONG pImageSize)
static int Protect(const char **args)
DWORD WINAPI VfdInstallDriver(PCSTR sFileName, DWORD nStart)
#define ENABLE_PROCESSED_INPUT
#define FORMAT_MESSAGE_IGNORE_INSERTS
_Check_return_opt_ _CRTIMP char *__cdecl fgets(_Out_writes_z_(_MaxCount) char *_Buf, _In_ int _MaxCount, _Inout_ FILE *_File)
static const char * help_progname
#define SERVICE_CONTINUE_PENDING
#define FILE_ATTRIBUTE_ENCRYPTED
static DWORD driver_state
GLenum GLenum GLenum input
static void PrintDriveLetter(HANDLE hDevice, ULONG nDrive)
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
DWORD WINAPI VfdSaveImage(HANDLE hDevice, PCSTR sFileName, BOOL bOverWrite, BOOL bTruncate)
_Check_return_opt_ _CRTIMP int __cdecl fflush(_Inout_opt_ FILE *_File)
DWORD WINAPI VfdCheckDriverFile(PCSTR sFileName, PULONG pFileVersion)
HLOCAL NTAPI LocalFree(HLOCAL hMem)
DWORD WINAPI VfdCheckImageFile(PCSTR sFileName, PDWORD pAttributes, PVFD_FILETYPE pFileType, PULONG pImageSize)
static const char topic[]
NTSTATUS VfdOpenImage(IN PDEVICE_EXTENSION DeviceExtension, IN PVFD_IMAGE_INFO ImageInfo)
CHAR WINAPI VfdChooseLetter()
static BOOL ConsolePager(char *pBuffer, BOOL bReset)
DWORD WINAPI VfdRemoveDriver()
char * strchr(const char *String, int ch)
#define SERVICE_AUTO_START
static int ParseHelpTopic(const char *topic)
char * strcpy(char *DstString, const char *SrcString)
int strcmp(const char *String1, const char *String2)
void WINAPI VfdMakeFileDesc(PSTR pBuffer, ULONG nBufSize, VFD_FILETYPE nFileType, ULONG nFileSize, DWORD nFileAttr)
#define VFD_COPYRIGHT_STR
static int InteractiveConsole()
#define ERROR_PATH_NOT_FOUND
static int Close(const char **args)
static int ParseCommand(const char *cmd)
BOOL WINAPI VfdIsValidPlatform()
#define WriteConsoleOutputCharacter
#define SERVICE_DEMAND_START
static const struct access_res create[16]
#define SERVICE_STOP_PENDING
#define _CrtSetDbgFlag(f)
#define SetCurrentDirectory
struct task_struct * current
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
static GLint image_size(GLint width, GLint height, GLenum format, GLenum type)
DWORD WINAPI VfdStopDriver(PDWORD pState)
BOOL WINAPI FindClose(HANDLE hFindFile)