ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
December 2017
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
26 participants
355 discussions
Start a n
N
ew thread
[reactos] 01/01: [VFD] Remove no longer required ReactOS specific change
by Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=132c7d926bedeaebbccae…
commit 132c7d926bedeaebbccaeed21ac179bdb122b0ee Author: Pierre Schweitzer <pierre(a)reactos.org> AuthorDate: Sat Dec 16 22:53:32 2017 +0100 [VFD] Remove no longer required ReactOS specific change CORE-14090 --- modules/rosapps/lib/vfdlib/vfdctl.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/modules/rosapps/lib/vfdlib/vfdctl.c b/modules/rosapps/lib/vfdlib/vfdctl.c index 69f8cd5abd..eb09da84d3 100644 --- a/modules/rosapps/lib/vfdlib/vfdctl.c +++ b/modules/rosapps/lib/vfdlib/vfdctl.c @@ -2928,15 +2928,8 @@ DWORD WINAPI VfdCheckDriverFile( fixedinfo->dwFileType != VFT_DRV || fixedinfo->dwFileSubtype != VFT2_DRV_SYSTEM) { -#ifndef __REACTOS__ VFDTRACE(0, (FUNC ": Invalid file type flags\n")); -#else - VFDTRACE(0, - (FUNC ": Invalid file type flags. os: %x (%x), type: %x (%x), subtype: %x (%x)\n", - fixedinfo->dwFileOS, VOS_NT_WINDOWS32, fixedinfo->dwFileType, VFT_DRV, - fixedinfo->dwFileSubtype, VFT2_DRV_SYSTEM)); -#endif ret = ERROR_BAD_DRIVER;
7 years
1
0
0
0
[reactos] 01/01: [VFDLIB] Fix preprocessor directive compilation error when being used inside a macro expansion on MSVC.
by Hermès Bélusca-Maïto
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=acabbb7b8595ca5794fc0…
commit acabbb7b8595ca5794fc0dfffc16c052fb4c0e72 Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org> AuthorDate: Sat Dec 16 22:48:11 2017 +0100 [VFDLIB] Fix preprocessor directive compilation error when being used inside a macro expansion on MSVC. --- modules/rosapps/lib/vfdlib/vfdctl.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/rosapps/lib/vfdlib/vfdctl.c b/modules/rosapps/lib/vfdlib/vfdctl.c index 54c3320e39..69f8cd5abd 100644 --- a/modules/rosapps/lib/vfdlib/vfdctl.c +++ b/modules/rosapps/lib/vfdlib/vfdctl.c @@ -2928,13 +2928,14 @@ DWORD WINAPI VfdCheckDriverFile( fixedinfo->dwFileType != VFT_DRV || fixedinfo->dwFileSubtype != VFT2_DRV_SYSTEM) { - VFDTRACE(0, #ifndef __REACTOS__ + VFDTRACE(0, (FUNC ": Invalid file type flags\n")); #else + VFDTRACE(0, (FUNC ": Invalid file type flags. os: %x (%x), type: %x (%x), subtype: %x (%x)\n", - fixedinfo->dwFileOS, VOS_NT_WINDOWS32, fixedinfo->dwFileType, VFT_DRV, - fixedinfo->dwFileSubtype, VFT2_DRV_SYSTEM)); + fixedinfo->dwFileOS, VOS_NT_WINDOWS32, fixedinfo->dwFileType, VFT_DRV, + fixedinfo->dwFileSubtype, VFT2_DRV_SYSTEM)); #endif ret = ERROR_BAD_DRIVER;
7 years
1
0
0
0
[reactos] 01/01: [VFD] Fix build on MSVC2010.
by Hermès Bélusca-Maïto
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e7b2aa65d26520d5a607b…
commit e7b2aa65d26520d5a607bee994ea23c6a745c895 Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org> AuthorDate: Sat Dec 16 22:34:20 2017 +0100 [VFD] Fix build on MSVC2010. --- modules/rosapps/drivers/vfd/vfdfmt.c | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/modules/rosapps/drivers/vfd/vfdfmt.c b/modules/rosapps/drivers/vfd/vfdfmt.c index 680dcbc7d3..0d65891e20 100644 --- a/modules/rosapps/drivers/vfd/vfdfmt.c +++ b/modules/rosapps/drivers/vfd/vfdfmt.c @@ -29,7 +29,6 @@ #ifndef __REACTOS__ extern DISK_GEOMETRY const geom_tbl[VFD_MEDIA_MAX] = { -DISK_GEOMETRY const geom_tbl[VFD_MEDIA_MAX] = { {{ 80 }, F3_1Pt44_512, 2, 18, VFD_BYTES_PER_SECTOR }, // default {{ 40 }, F5_160_512, 1, 8, VFD_BYTES_PER_SECTOR }, // 160K {{ 40 }, F5_180_512, 1, 9, VFD_BYTES_PER_SECTOR }, // 180K @@ -48,22 +47,22 @@ DISK_GEOMETRY const geom_tbl[VFD_MEDIA_MAX] = { {{ 80 }, F3_2Pt88_512, 2, 36, VFD_BYTES_PER_SECTOR }, // 2880K #else DISK_GEOMETRY const geom_tbl[VFD_MEDIA_MAX] = { - {{ .QuadPart = 80 }, F3_1Pt44_512, 2, 18, VFD_BYTES_PER_SECTOR }, // default - {{ .QuadPart = 40 }, F5_160_512, 1, 8, VFD_BYTES_PER_SECTOR }, // 160K - {{ .QuadPart = 40 }, F5_180_512, 1, 9, VFD_BYTES_PER_SECTOR }, // 180K - {{ .QuadPart = 40 }, F5_320_512, 2, 8, VFD_BYTES_PER_SECTOR }, // 320K - {{ .QuadPart = 40 }, F5_360_512, 2, 9, VFD_BYTES_PER_SECTOR }, // 360K - {{ .QuadPart = 80 }, F3_640_512, 2, 8, VFD_BYTES_PER_SECTOR }, // 640k - {{ .QuadPart = 80 }, F5_640_512, 2, 8, VFD_BYTES_PER_SECTOR }, // 640k - {{ .QuadPart = 80 }, F3_720_512, 2, 9, VFD_BYTES_PER_SECTOR }, // 720K - {{ .QuadPart = 80 }, F5_720_512, 2, 9, VFD_BYTES_PER_SECTOR }, // 720K - {{ .QuadPart = 82 }, RemovableMedia, 2, 10, VFD_BYTES_PER_SECTOR }, // 820K - {{ .QuadPart = 80 }, F3_1Pt2_512, 2, 15, VFD_BYTES_PER_SECTOR }, // 1200K - {{ .QuadPart = 80 }, F5_1Pt2_512, 2, 15, VFD_BYTES_PER_SECTOR }, // 1200K - {{ .QuadPart = 80 }, F3_1Pt44_512, 2, 18, VFD_BYTES_PER_SECTOR }, // 1440K - {{ .QuadPart = 80 }, RemovableMedia, 2, 21, VFD_BYTES_PER_SECTOR }, // 1680K DMF - {{ .QuadPart = 82 }, RemovableMedia, 2, 21, VFD_BYTES_PER_SECTOR }, // 1720K DMF - {{ .QuadPart = 80 }, F3_2Pt88_512, 2, 36, VFD_BYTES_PER_SECTOR }, // 2880K + {{ {80} }, F3_1Pt44_512, 2, 18, VFD_BYTES_PER_SECTOR }, // default + {{ {40} }, F5_160_512, 1, 8, VFD_BYTES_PER_SECTOR }, // 160K + {{ {40} }, F5_180_512, 1, 9, VFD_BYTES_PER_SECTOR }, // 180K + {{ {40} }, F5_320_512, 2, 8, VFD_BYTES_PER_SECTOR }, // 320K + {{ {40} }, F5_360_512, 2, 9, VFD_BYTES_PER_SECTOR }, // 360K + {{ {80} }, F3_640_512, 2, 8, VFD_BYTES_PER_SECTOR }, // 640k + {{ {80} }, F5_640_512, 2, 8, VFD_BYTES_PER_SECTOR }, // 640k + {{ {80} }, F3_720_512, 2, 9, VFD_BYTES_PER_SECTOR }, // 720K + {{ {80} }, F5_720_512, 2, 9, VFD_BYTES_PER_SECTOR }, // 720K + {{ {82} }, RemovableMedia, 2, 10, VFD_BYTES_PER_SECTOR }, // 820K + {{ {80} }, F3_1Pt2_512, 2, 15, VFD_BYTES_PER_SECTOR }, // 1200K + {{ {80} }, F5_1Pt2_512, 2, 15, VFD_BYTES_PER_SECTOR }, // 1200K + {{ {80} }, F3_1Pt44_512, 2, 18, VFD_BYTES_PER_SECTOR }, // 1440K + {{ {80} }, RemovableMedia, 2, 21, VFD_BYTES_PER_SECTOR }, // 1680K DMF + {{ {82} }, RemovableMedia, 2, 21, VFD_BYTES_PER_SECTOR }, // 1720K DMF + {{ {80} }, F3_2Pt88_512, 2, 36, VFD_BYTES_PER_SECTOR }, // 2880K #endif };
7 years
1
0
0
0
[reactos] 01/01: [VFD] Fix build
by Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=2a146533a5c6d279c519e…
commit 2a146533a5c6d279c519e047e91bf06379a0f1d6 Author: Pierre Schweitzer <pierre(a)reactos.org> AuthorDate: Sat Dec 16 22:00:41 2017 +0100 [VFD] Fix build --- modules/rosapps/lib/vfdlib/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/rosapps/lib/vfdlib/CMakeLists.txt b/modules/rosapps/lib/vfdlib/CMakeLists.txt index b0ff8b9e7c..07244f8045 100644 --- a/modules/rosapps/lib/vfdlib/CMakeLists.txt +++ b/modules/rosapps/lib/vfdlib/CMakeLists.txt @@ -26,7 +26,7 @@ endif() add_library(vfd SHARED ${SOURCE} vfdlib.rc - ${CMAKE_CURRENT_BINARY_DIR}/vfdlib.def) + ${CMAKE_CURRENT_BINARY_DIR}/vfd.def) include_directories(${REACTOS_SOURCE_DIR}/modules/rosapps/include/vfd ${REACTOS_SOURCE_DIR}/sdk/include/reactos/libs/zlib)
7 years
1
0
0
0
[reactos] 01/01: [VFD] Build with debug information on debug builds
by Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=753d87468c8f5e350d34b…
commit 753d87468c8f5e350d34bb48141493698ae65e8c Author: Pierre Schweitzer <pierre(a)reactos.org> AuthorDate: Sat Dec 16 21:57:11 2017 +0100 [VFD] Build with debug information on debug builds CORE-14090 --- modules/rosapps/lib/vfdlib/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/rosapps/lib/vfdlib/CMakeLists.txt b/modules/rosapps/lib/vfdlib/CMakeLists.txt index 2ceeb8f41f..b0ff8b9e7c 100644 --- a/modules/rosapps/lib/vfdlib/CMakeLists.txt +++ b/modules/rosapps/lib/vfdlib/CMakeLists.txt @@ -19,6 +19,10 @@ list(APPEND SOURCE vfdshutil.cpp vfdzip.c) +if(DBG) + add_definitions(-D_DEBUG) +endif() + add_library(vfd SHARED ${SOURCE} vfdlib.rc
7 years
1
0
0
0
[reactos] 02/02: [VFD] Import the VFD project (Virtual Floppy Drive) which allows creating virtual floppy drives in ReactOS and mount images on them. Only the cmd got imported. The GUI interface may come later on. Note that, as for vcdrom, the driver is left disabled and you need to explicitely start it through vfd command line interface.
by Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=25c7e1a8d049932380fb1…
commit 25c7e1a8d049932380fb101bf413142dd058d723 Author: Pierre Schweitzer <pierre(a)reactos.org> AuthorDate: Sat Dec 16 21:48:17 2017 +0100 [VFD] Import the VFD project (Virtual Floppy Drive) which allows creating virtual floppy drives in ReactOS and mount images on them. Only the cmd got imported. The GUI interface may come later on. Note that, as for vcdrom, the driver is left disabled and you need to explicitely start it through vfd command line interface. CORE-14090 --- modules/rosapps/CMakeLists.txt | 1 + .../rosapps/applications/cmdutils/CMakeLists.txt | 1 + .../applications/cmdutils/vfdcmd/CMakeLists.txt | 10 + .../rosapps/applications/cmdutils/vfdcmd/vfdcmd.c | 3498 ++++++++++++++++++++ .../rosapps/applications/cmdutils/vfdcmd/vfdcmd.rc | 6 + .../rosapps/applications/cmdutils/vfdcmd/vfdcmd.rs | 49 + .../rosapps/applications/cmdutils/vfdcmd/vfdmsg.mc | 1596 +++++++++ modules/rosapps/drivers/CMakeLists.txt | 1 + modules/rosapps/drivers/vfd/CMakeLists.txt | 19 + modules/rosapps/drivers/vfd/imports.h | 357 ++ modules/rosapps/drivers/vfd/vfd_reg.inf | 7 + modules/rosapps/drivers/vfd/vfddbg.c | 1799 ++++++++++ modules/rosapps/drivers/vfd/vfddbg.h | 79 + modules/rosapps/drivers/vfd/vfddev.c | 407 +++ modules/rosapps/drivers/vfd/vfddrv.c | 523 +++ modules/rosapps/drivers/vfd/vfddrv.h | 357 ++ modules/rosapps/drivers/vfd/vfddrv.rc | 30 + modules/rosapps/drivers/vfd/vfdfmt.c | 234 ++ modules/rosapps/drivers/vfd/vfdimg.c | 527 +++ modules/rosapps/drivers/vfd/vfdioctl.c | 591 ++++ modules/rosapps/drivers/vfd/vfdlink.c | 226 ++ modules/rosapps/drivers/vfd/vfdmnt.c | 665 ++++ modules/rosapps/drivers/vfd/vfdpnp.c | 474 +++ modules/rosapps/drivers/vfd/vfdrdwr.c | 357 ++ modules/rosapps/include/CMakeLists.txt | 1 + modules/rosapps/include/vfd/CMakeLists.txt | 0 modules/rosapps/include/vfd/vfdapi.h | 324 ++ modules/rosapps/include/vfd/vfdio.h | 393 +++ modules/rosapps/include/vfd/vfdtypes.h | 77 + modules/rosapps/include/vfd/vfdver.h | 72 + modules/rosapps/include/vfd/vfdver.rc | 79 + modules/rosapps/lib/CMakeLists.txt | 1 + modules/rosapps/lib/vfdlib/CMakeLists.txt | 33 + modules/rosapps/lib/vfdlib/res/config.ico | Bin 0 -> 1078 bytes modules/rosapps/lib/vfdlib/res/image.ico | Bin 0 -> 1078 bytes modules/rosapps/lib/vfdlib/res/vfd.ico | Bin 0 -> 1078 bytes modules/rosapps/lib/vfdlib/vfdctl.c | 3272 ++++++++++++++++++ modules/rosapps/lib/vfdlib/vfdfat.c | 205 ++ modules/rosapps/lib/vfdlib/vfdguiopen.c | 562 ++++ modules/rosapps/lib/vfdlib/vfdguirc.h | 47 + modules/rosapps/lib/vfdlib/vfdguisave.c | 529 +++ modules/rosapps/lib/vfdlib/vfdguitip.c | 354 ++ modules/rosapps/lib/vfdlib/vfdguiut.c | 581 ++++ modules/rosapps/lib/vfdlib/vfdlib.c | 184 + modules/rosapps/lib/vfdlib/vfdlib.h | 185 ++ modules/rosapps/lib/vfdlib/vfdlib.rc | 219 ++ modules/rosapps/lib/vfdlib/vfdlib.rs | 83 + modules/rosapps/lib/vfdlib/vfdlib.spec | 55 + modules/rosapps/lib/vfdlib/vfdmsg_lib.mc | 523 +++ modules/rosapps/lib/vfdlib/vfdshcfact.cpp | 126 + modules/rosapps/lib/vfdlib/vfdshcfact.h | 42 + modules/rosapps/lib/vfdlib/vfdshext.cpp | 235 ++ modules/rosapps/lib/vfdlib/vfdshext.h | 99 + modules/rosapps/lib/vfdlib/vfdshguid.h | 17 + modules/rosapps/lib/vfdlib/vfdshmenu.cpp | 597 ++++ modules/rosapps/lib/vfdlib/vfdshprop.cpp | 434 +++ modules/rosapps/lib/vfdlib/vfdshutil.cpp | 419 +++ modules/rosapps/lib/vfdlib/vfdzip.c | 422 +++ 58 files changed, 21984 insertions(+) diff --git a/modules/rosapps/CMakeLists.txt b/modules/rosapps/CMakeLists.txt index 7ffa0b4d85..58a32c1c18 100644 --- a/modules/rosapps/CMakeLists.txt +++ b/modules/rosapps/CMakeLists.txt @@ -1,6 +1,7 @@ add_subdirectory(applications) add_subdirectory(demos) add_subdirectory(drivers) +add_subdirectory(include) add_subdirectory(lib) add_subdirectory(templates) diff --git a/modules/rosapps/applications/cmdutils/CMakeLists.txt b/modules/rosapps/applications/cmdutils/CMakeLists.txt index 843b2c5be5..6d5488d30a 100644 --- a/modules/rosapps/applications/cmdutils/CMakeLists.txt +++ b/modules/rosapps/applications/cmdutils/CMakeLists.txt @@ -6,5 +6,6 @@ add_subdirectory(tee) add_subdirectory(touch) add_subdirectory(uptime) add_subdirectory(vcdcli) +add_subdirectory(vfdcmd) add_subdirectory(winspool_print) add_subdirectory(y) diff --git a/modules/rosapps/applications/cmdutils/vfdcmd/CMakeLists.txt b/modules/rosapps/applications/cmdutils/vfdcmd/CMakeLists.txt new file mode 100644 index 0000000000..fa653f1818 --- /dev/null +++ b/modules/rosapps/applications/cmdutils/vfdcmd/CMakeLists.txt @@ -0,0 +1,10 @@ + +add_message_headers(ANSI vfdmsg.mc) + +include_directories(${REACTOS_SOURCE_DIR}/modules/rosapps/include/vfd) +add_executable(vfdcmd vfdcmd.c vfdcmd.rc) +set_module_type(vfdcmd win32cui) +add_importlibs(vfdcmd advapi32 vfd user32 msvcrt kernel32 ntdll) +add_dependencies(vfdcmd vfdmsg) +set_target_properties(vfdcmd PROPERTIES OUTPUT_NAME "vfd") +add_cd_file(TARGET vfdcmd DESTINATION reactos/system32 FOR all) diff --git a/modules/rosapps/applications/cmdutils/vfdcmd/vfdcmd.c b/modules/rosapps/applications/cmdutils/vfdcmd/vfdcmd.c new file mode 100644 index 0000000000..8cd40bfd93 --- /dev/null +++ b/modules/rosapps/applications/cmdutils/vfdcmd/vfdcmd.c @@ -0,0 +1,3498 @@ +/* + vfdcmd.c + + Virtual Floppy Drive for Windows + Driver control program (console version) + + Copyright (C) 2003-2008 Ken Kato +*/ + +#ifdef __cplusplus +#pragma message(__FILE__": Compiled as C++ for testing purpose.") +#endif // __cplusplus + +#define WIN32_LEAN_AND_MEAN +#define _CRTDBG_MAP_ALLOC +#include <windows.h> +#include <stdio.h> +#include <stdarg.h> +#include <stdlib.h> +#include <crtdbg.h> + +#ifndef INVALID_FILE_ATTRIBUTES +#define INVALID_FILE_ATTRIBUTES ((DWORD)-1) +#endif // INVALID_FILE_ATTRIBUTES + +#include "vfdtypes.h" +#include "vfdapi.h" +#include "vfdver.h" +#include "vfdmsg.h" + +// +// current driver state +// +static DWORD driver_state = VFD_NOT_INSTALLED; + +// +// interactive flag +// +static const char *help_progname = "VFD.EXE "; + +// +// command functions return value +// +#define VFD_OK 0 +#define VFD_NG 1 + +// +// operation mode +// +#define OPERATION_ASK 0 // ask user on error +#define OPERATION_QUIT 1 // quits on error +#define OPERATION_FORCE 2 // force on error + +// +// invalid target number +// +#define TARGET_NONE (ULONG)-1 + +// +// command processing functions +// +typedef int (*cmdfnc)(const char **args); + +static int Install(const char **args); +static int Remove(const char **args); +static int Config(const char **args); +static int Start(const char **args); +static int Stop(const char **args); +static int Shell(const char **args); +static int Open(const char **args); +static int Close(const char **args); +static int Save(const char **args); +static int Protect(const char **args); +static int Format(const char **args); +static int Link(const char **args); +static int Unlink(const char **args); +static int Status(const char **args); +static int Help(const char **args); +static int Version(const char **args); + +// +// Command table +// +static const struct { + char *cmd; // command string + int max_args; // maximum allowed number of argc + cmdfnc func; // command processing function + DWORD hint; // command hint message id +} +Commands[] = { + {"INSTALL", 2, Install, MSG_HINT_INSTALL}, + {"REMOVE", 1, Remove, MSG_HINT_REMOVE }, + {"CONFIG", 1, Config, MSG_HINT_CONFIG }, + {"START", 0, Start, MSG_HINT_START }, + {"STOP", 1, Stop, MSG_HINT_STOP }, + {"SHELL", 1, Shell, MSG_HINT_SHELL }, + {"OPEN", 6, Open, MSG_HINT_OPEN }, + {"CLOSE", 2, Close, MSG_HINT_CLOSE }, + {"SAVE", 3, Save, MSG_HINT_SAVE, }, + {"PROTECT", 2, Protect, MSG_HINT_PROTECT}, + {"FORMAT", 2, Format, MSG_HINT_FORMAT }, + {"LINK", 3, Link, MSG_HINT_LINK }, + {"ULINK", 1, Unlink, MSG_HINT_ULINK }, + {"STATUS", 0, Status, MSG_HINT_STATUS }, + {"HELP", 1, Help, MSG_HELP_HELP }, + {"?", 1, Help, MSG_HELP_HELP }, + {"VERSION", 0, Version, MSG_HINT_VERSION}, + {0, 0, 0, 0} +}; + +// +// Help message table +// +static const struct { + char *keyword; // help keyword + DWORD help; // help message id +} +HelpMsg[] = { + {"GENERAL", MSG_HELP_GENERAL}, + {"CONSOLE", MSG_HELP_CONSOLE}, + {"INSTALL", MSG_HELP_INSTALL}, + {"REMOVE", MSG_HELP_REMOVE }, + {"CONFIG", MSG_HELP_CONFIG }, + {"START", MSG_HELP_START }, + {"STOP", MSG_HELP_STOP }, + {"SHELL", MSG_HELP_SHELL }, + {"OPEN", MSG_HELP_OPEN }, + {"CLOSE", MSG_HELP_CLOSE }, + {"SAVE", MSG_HELP_SAVE }, + {"PROTECT", MSG_HELP_PROTECT}, + {"FORMAT", MSG_HELP_FORMAT }, + {"LINK", MSG_HELP_LINK }, + {"ULINK", MSG_HELP_ULINK }, + {"STATUS", MSG_HELP_STATUS }, + {"HELP", MSG_HELP_HELP }, + {"VERSION", MSG_HINT_VERSION}, + {0, 0} +}; + +// +// local functions +// +static int InteractiveConsole(); +static int ProcessCommandLine(int argc, const char **args); +static int ParseCommand(const char *cmd); +static int ParseHelpTopic(const char *topic); +static int CheckDriver(); +static int InputChar(ULONG msg, PCSTR ans); +static void PrintImageInfo(HANDLE hDevice); +static void PrintDriveLetter(HANDLE hDevice, ULONG nDrive); +static void PrintMessage(UINT msg, ...); +static BOOL ConsolePager(char *pBuffer, BOOL bReset); +static const char *SystemError(DWORD err); +static void ConvertPathCase(char *src, char *dst); + +// +// utility macro +// +#define IS_WINDOWS_NT() ((GetVersion() & 0xff) < 5) + +// +// main +// +int main(int argc, const char **argv) +{ +#ifdef _DEBUG + + // output vfd.exe command reference text + + if (*(argv + 1) && !_stricmp(*(argv + 1), "doc")) { + int idx = 0; + char *buf = ""; + + printf("\r\n VFD.EXE Command Reference\r\n"); + + while (HelpMsg[idx].keyword) { + int len = strlen(HelpMsg[idx].keyword); + + printf( + "\r\n\r\n" + "====================\r\n" + "%*s\r\n" + "====================\r\n" + "\r\n", + (20 + len) / 2, HelpMsg[idx].keyword); + + FormatMessage( + FORMAT_MESSAGE_FROM_HMODULE | + FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_ARGUMENT_ARRAY, + NULL, HelpMsg[idx].help, 0, + (LPTSTR)&buf, 0, (va_list *)&help_progname); + + printf("%s", buf); + + LocalFree(buf); + + idx++; + } + + return 0; + } +#endif + + // Reports memory leaks at process termination + + _CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | _CRTDBG_LEAK_CHECK_DF); + + // Check the operating system version + + if (!VfdIsValidPlatform()) { + PrintMessage(MSG_WRONG_PLATFORM); + return VFD_NG; + } + + if (argc < 2) { + // If no parameter is given, enter the interactive mode + + return InteractiveConsole(); + } + else { + // Perform a single operation + + return ProcessCommandLine(argc - 1, argv + 1); + } +} + +// +// VFD interactive console +// +int InteractiveConsole() +{ + char input[1024]; // user input buffer + + int argc; // number of args in the user input + char *args[10]; // args to pass to command functions + + char sepa; // argument separator + char *p; // work pointer + + // Disable the system default Ctrl+C handler + + SetConsoleCtrlHandler(NULL, TRUE); + + // Set the console title + + SetConsoleTitle(VFD_PRODUCT_DESC); + + // print version information and the console hint text + + Version(NULL); + + PrintMessage(MSG_CONSOLE_HINT); + + // set interactive flag to exclude "VFD.EXE" from help text + + help_progname = ""; + + // process user input + + for (;;) { + + // print the prompt + + printf("[VFD] "); + fflush(stdout); + + // read user input + + fflush(stdin); + p = fgets(input, sizeof(input), stdin); + + if (p == NULL) { + + // most likely <ctrl+c> + + printf("exit\n"); + break; + } + + // skip leading blank characters + + while (*p == ' ' || *p == '\t' || *p == '\n') { + p++; + } + + if (*p == '\0') { + + // empty input + + continue; + } + + // handle external commands + + if (!_strnicmp(p, "dir", 3) || + !_strnicmp(p, "attrib", 6)) { + + // special cases - frequently used commands + // pass these to system() even without '.' + + system(p); + printf("\n"); + continue; + } + else if (*p == '.') { + + // external command + + system(p + 1); + printf("\n"); + continue; + } + + // split the input line into parameters (10 parameters max) + + argc = 0; + ZeroMemory(args, sizeof(args)); + + do { + // top of a parameter + + args[argc++] = p; + + // is the parameter quoted? + + if (*p == '\"' || *p == '\'') { + sepa = *(p++); + } + else { + sepa = ' '; + } + + // search the end of the parameter + + while (*p && *p != '\n') { + if (sepa == ' ') { + if (*p == '\t' || *p == ' ') { + break; // tail of a non-quoted parameter + } + } + else { + if (*p == sepa) { + sepa = ' '; // close quote + } + } + p++; + } + + // terminate the parameter + + if (*p) { + *(p++) = '\0'; + } + + // skip trailing blank characters + + while (*p == ' ' || *p == '\t' || *p == '\n') { + p++; + } + + if (*p == '\0') { + + // end of the input line - no more args + + break; + } + } + while (argc < sizeof(args) / sizeof(args[0])); + + // check the first parameter for special commands + + if (!_stricmp(args[0], "exit") || + !_stricmp(args[0], "quit") || + !_stricmp(args[0], "bye")) { + + // exit command + + break; + } + else if (!_stricmp(args[0], "cd") || + !_stricmp(args[0], "chdir")) { + + // internal change directory command + + if (args[1]) { + char path[MAX_PATH]; + int i; + + // ignore the /d option (of the standard cd command) + + if (_stricmp(args[1], "/d")) { + i = 1; + } + else { + i = 2; + } + + p = args[i]; + + if (*p == '\"' || *p == '\'') { + + // the parameter is quoted -- remove quotations + + p++; + + while (*p && *p != *args[i]) { + p++; + } + + args[i]++; // skip a leading quote + *p = '\0'; // remove a trailing quote + } + else { + + // the parameter is not quoted + // -- concatenate params to allow spaces in unquoted path + + while (i < argc - 1) { + *(args[i] + strlen(args[i])) = ' '; + i++; + } + } + + // Match the case of the path to the name on the disk + + ConvertPathCase(p, path); + + if (!SetCurrentDirectory(path)) { + DWORD ret = GetLastError(); + + if (ret == ERROR_FILE_NOT_FOUND) { + ret = ERROR_PATH_NOT_FOUND; + } + + printf("%s", SystemError(ret)); + } + } + else { + if (!GetCurrentDirectory(sizeof(input), input)) { + printf("%s", SystemError(GetLastError())); + } + else { + printf("%s\n", input); + } + } + } + else if (isalpha(*args[0]) && + *(args[0] + 1) == ':' && + *(args[0] + 2) == '\0') { + + // internal change drive command + + *args[0] = (char)toupper(*args[0]); + *(args[0] + 2) = '\\'; + *(args[0] + 3) = '\0'; + + if (!SetCurrentDirectory(args[0])) { + printf("%s", SystemError(GetLastError())); + } + } + else { + + // perform the requested VFD command + + ProcessCommandLine(argc, (const char **)args); + } + + printf("\n"); + } + + return VFD_OK; +} + +// +// process a single command +// +int ProcessCommandLine(int argc, const char **args) +{ + int cmd; + DWORD ret; + + // + // Decide a command to perform + // + cmd = ParseCommand(*args); + + if (cmd < 0) { + + // no matching command + + return VFD_NG; + } + + if (*(++args) && + (!strcmp(*args, "/?") || + !_stricmp(*args, "/h"))) { + + // print a short hint for the command + + PrintMessage(Commands[cmd].hint); + return VFD_NG; + } + + if (--argc > Commands[cmd].max_args) { + + // too many parameters for the command + + PrintMessage(MSG_TOO_MANY_ARGS); + PrintMessage(Commands[cmd].hint); + return VFD_NG; + } + + // Get the current driver state + + ret = VfdGetDriverState(&driver_state); + + if (ret != ERROR_SUCCESS) { + PrintMessage(MSG_GET_STAT_NG); + printf("%s", SystemError(ret)); + return VFD_NG; + } + + // Perform the requested operation + + return (*Commands[cmd].func)(args); +} + +// +// Install the Virtual Floppy Driver +// Command Line Parameters: +// (optional) driver file path - default to executive's dir +// (optional) auto start switch - default to demand start +// +int Install(const char **args) +{ + const char *install_path = NULL; + DWORD start_type = SERVICE_DEMAND_START; + + DWORD ret; + + // process parameters + + while (args && *args) { + + if (!_stricmp(*args, "/a") || + !_stricmp(*args, "/auto")) { + + if (start_type != SERVICE_DEMAND_START) { + PrintMessage(MSG_DUPLICATE_ARGS, *args); + return VFD_NG; + } +/* + if (IS_WINDOWS_NT()) { + + // On Windows NT, SYSTEM start drivers must be placed + // under the winnt\system32 directory. Since I don't + // care to handle driver file copying, I use the AUTO + // start method for Windows NT. + + start_type = SERVICE_AUTO_START; + } + else { + + // On Windows XP, the VFD driver must be running when + // the shell starts -- otherwise the shell doesn't + // recognize the VFD drives. Since Windows XP allows + // SYSTEM start drivers to be placed in any local + // directories, I use the SYSTEM start method here. + // + // This is not an issue when the driver is started + // manually because in that case VFD.EXE and VFDWIN.EXE + // notify the shell of the VFD drives. + // + // On Windows 2000 both SYSTEM and AUTO work fine. + + start_type = SERVICE_SYSTEM_START; + } +*/ + // On second thought -- Win2K / XP mount manager assigns + // arbitrary drive letters to all drives it finds during + // the system start up. There is no way to prevent it + // until the driver is fully PnP compatible, so I'd settle + // for AUTO start for the time being. + + start_type = SERVICE_AUTO_START; + } + else if (**args == '/') { + PrintMessage(MSG_UNKNOWN_OPTION, *args); + PrintMessage(MSG_HINT_INSTALL, help_progname); + return VFD_NG; + } + else { + if (install_path) { + PrintMessage(MSG_DUPLICATE_ARGS, "path"); + return VFD_NG; + } + + install_path = *args; + } + + args++; + } + + // already installed? + + if (driver_state != VFD_NOT_INSTALLED) { + PrintMessage(MSG_DRIVER_EXISTS); + return VFD_NG; + } + + // install the driver + + ret = VfdInstallDriver( + install_path, + start_type); + + if (ret != ERROR_SUCCESS) { + PrintMessage(MSG_INSTALL_NG); + printf("%s", SystemError(ret)); + return VFD_NG; + } + + // Get the latest driver state + + ret = VfdGetDriverState(&driver_state); + + if (ret != ERROR_SUCCESS) { + PrintMessage(MSG_GET_STAT_NG); + printf("%s", SystemError(ret)); + return VFD_NG; + } + + // operation successfull + + PrintMessage(MSG_INSTALL_OK); + + return VFD_OK; +} + +// +// Remove Virtual Floppy Driver from system +// Command Line Parameters: +// [/F | /FORCE | /Q | /QUIT] +// /F forces remove operation if the driver cannot be stopped +// /Q quits remove operation if the driver cannot be stopped +// +int Remove(const char **args) +{ + int mode = OPERATION_ASK; + const char *stop_params[] = { NULL, NULL }; + DWORD ret; + int idx; + + // parse parameters + + while (args && *args) { + + if (!_stricmp(*args, "/f") || + !_stricmp(*args, "/force")) { + + if (mode != OPERATION_ASK) { + PrintMessage(MSG_DUPLICATE_ARGS, *args); + return VFD_NG; + } + + mode = OPERATION_FORCE; + stop_params[0] = *args; + } + else if (!_stricmp(*args, "/q") || + !_stricmp(*args, "/quit")) { + + if (mode != OPERATION_ASK) { + PrintMessage(MSG_DUPLICATE_ARGS, *args); + return VFD_NG; + } + + mode = OPERATION_QUIT; + stop_params[0] = *args; + } + else { + PrintMessage(MSG_UNKNOWN_OPTION, *args); + PrintMessage(MSG_HINT_REMOVE, help_progname); + return VFD_NG; + } + + args++; + } + + // ensure the driver is installed + + if (driver_state == VFD_NOT_INSTALLED) { + PrintMessage(MSG_NOT_INSTALLED); + return VFD_NG; + } + + // ensure the driver is stopped + + if (driver_state == SERVICE_RUNNING) { + + // Try to stop with the same command line option (/F or /Q) + + while (Stop(stop_params) != VFD_OK) { + + // stop failed + + if (mode == OPERATION_FORCE) { + PrintMessage(MSG_REMOVE_FORCE); + break; + } + else if (mode == OPERATION_QUIT) { + PrintMessage(MSG_REMOVE_QUIT); + return VFD_NG; + } + else { + int c; + + PrintMessage(MSG_REMOVE_WARN); + + c = InputChar(MSG_RETRY_FORCE_CANCEL, "rfc"); + + if (c == 'f') { // force + break; + } + else if (c == 'c') { // cancel + return VFD_NG; + } + } + } + } + + // remove the driver + + ret = VfdRemoveDriver(); + + if (ret != ERROR_SUCCESS) { + PrintMessage(MSG_REMOVE_NG); + printf("%s", SystemError(ret)); + return VFD_NG; + } + + // Wait for the driver to be actually removed for 3 secs Max. + + for (idx = 0; idx < 10; idx++) { + + ret = VfdGetDriverState(&driver_state); + + if (ret != ERROR_SUCCESS) { + PrintMessage(MSG_GET_STAT_NG); + printf("%s", SystemError(ret)); + return VFD_NG; + } + + if (driver_state == VFD_NOT_INSTALLED) { + break; + } + + Sleep(300); + } + + if (driver_state != VFD_NOT_INSTALLED) { + PrintMessage(MSG_REMOVE_PENDING); + return VFD_NG; + } + + // operation successful + + PrintMessage(MSG_REMOVE_OK); + + return VFD_OK; +} + +// +// Configure the Virtual Floppy Driver +// Command Line Parameters: +// /auto, /manual +// +int Config(const char **args) +{ + DWORD start_type = SERVICE_DISABLED; + DWORD ret; + + while (args && *args) { + if (!_stricmp(*args, "/a") || + !_stricmp(*args, "/auto")) { + + if (start_type != SERVICE_DISABLED) { + PrintMessage(MSG_DUPLICATE_ARGS, *args); + return VFD_NG; + } + + start_type = SERVICE_AUTO_START; + } + else if (!_stricmp(*args, "/m") || + !_stricmp(*args, "/manual")) { + + if (start_type != SERVICE_DISABLED) { + PrintMessage(MSG_DUPLICATE_ARGS, *args); + return VFD_NG; + } + + start_type = SERVICE_DEMAND_START; + } + else { + PrintMessage(MSG_UNKNOWN_OPTION, *args); + PrintMessage(MSG_HINT_CONFIG, help_progname); + return VFD_NG; + } + + args++; + } + + if (start_type == SERVICE_DISABLED) { + // no parameter is specified + PrintMessage(MSG_HINT_CONFIG, help_progname); + return VFD_NG; + } + + // ensure that the driver is installed + + if (driver_state == VFD_NOT_INSTALLED) { + PrintMessage(MSG_NOT_INSTALLED); + return VFD_NG; + } + + // ensure that the driver is up to date + + if (CheckDriver() != VFD_OK) { + return VFD_NG; + } + + // configure the driver + + ret = VfdConfigDriver(start_type); + + if (ret != ERROR_SUCCESS) { + PrintMessage(MSG_CONFIG_NG); + printf("%s", SystemError(ret)); + return VFD_NG; + } + + // operation successfull + + PrintMessage(MSG_CONFIG_OK); + + return VFD_OK; +} + +// +// Start the Virtual Floppy Driver +// Command Line Parameters: None +// +int Start(const char **args) +{ + DWORD ret; + + UNREFERENCED_PARAMETER(args); + + // ensure that the driver is installed + + if (driver_state == VFD_NOT_INSTALLED && + Install(NULL) != VFD_OK) { + return VFD_NG; + } + + // ensure that the driver is up to date + + if (CheckDriver() != VFD_OK) { + return VFD_NG; + } + + // ensure that the driver is not running + + if (driver_state == SERVICE_RUNNING) { + PrintMessage(MSG_ALREADY_RUNNING); + return VFD_NG; + } + + // start the driver + + ret = VfdStartDriver(&driver_state); + + if (ret != ERROR_SUCCESS) { + PrintMessage(MSG_START_NG); + printf("%s", SystemError(ret)); + return VFD_NG; + } + + // operation successfull + + PrintMessage(MSG_START_OK); + + return VFD_OK; +} + +// +// Stop the Virtual Floppy Driver +// Command Line Parameters: +// /FORCE | /F Forces the operation on error +// /QUIT | /Q Quits the operation on error +// +int Stop(const char **args) +{ + int mode = OPERATION_ASK; + const char *close_params[] = { "*", NULL, NULL }; + DWORD ret; + + while (args && *args) { + if (!_stricmp(*args, "/f") || + !_stricmp(*args, "/force")) { + + if (mode != OPERATION_ASK) { + PrintMessage(MSG_DUPLICATE_ARGS, *args); + return VFD_NG; + } + + mode = OPERATION_FORCE; + + // parameter to pass to the Close() function + close_params[1] = *args; + } + else if (!_stricmp(*args, "/q") || + !_stricmp(*args, "/quit")) { + + if (mode != OPERATION_ASK) { + PrintMessage(MSG_DUPLICATE_ARGS, *args); + return VFD_NG; + } + + mode = OPERATION_QUIT; + + // parameter to pass to the Close() function + close_params[1] = *args; + } + else { + PrintMessage(MSG_UNKNOWN_OPTION, *args); + PrintMessage(MSG_HINT_STOP, help_progname); + return VFD_NG; + } + + args++; + } + + // ensure that the driver is installed + + if (driver_state == VFD_NOT_INSTALLED) { + PrintMessage(MSG_NOT_INSTALLED); + return VFD_NG; + } + + // ensure that the driver is running + + if (driver_state == SERVICE_STOPPED) { + PrintMessage(MSG_NOT_STARTED); + return VFD_NG; + } + + // ensure that all drives are empty + + if (driver_state == SERVICE_RUNNING) { + + // Try to close drives with the same operation mode (/F or /Q) + + while (Close(close_params) != VFD_OK) { + + // close failed + + if (mode == OPERATION_FORCE) { + PrintMessage(MSG_STOP_FORCE); + break; + } + else if (mode == OPERATION_QUIT) { + PrintMessage(MSG_STOP_QUIT); + return VFD_NG; + } + else { + int c; + + PrintMessage(MSG_STOP_WARN); + + c = InputChar(MSG_RETRY_FORCE_CANCEL, "rfc"); + + if (c == 'f') { // force + break; + } + else if (c == 'c') { // cancel + return VFD_NG; + } + } + } + } + + // stop the driver + + ret = VfdStopDriver(&driver_state); + + if (ret != ERROR_SUCCESS) { + PrintMessage(MSG_STOP_NG); + printf("%s", SystemError(ret)); + return VFD_NG; + } + + if (driver_state != SERVICE_STOPPED) { + PrintMessage(MSG_STOP_PENDING); + return VFD_NG; + } + + // operation successful + + PrintMessage(MSG_STOP_OK); + + return VFD_OK; +} + +// +// Enable / Disable the shell extension +// Command Line Parameters: +// (optional) /ON or /OFF +// +int Shell(const char **args) +{ + DWORD ret; + + ret = VfdCheckHandlers(); + + if (ret != ERROR_SUCCESS && + ret != ERROR_PATH_NOT_FOUND && + ret != ERROR_FILE_NOT_FOUND) { + PrintMessage(MSG_GET_SHELLEXT_NG); + printf("%s", SystemError(ret)); + return VFD_NG; + } + + if (args && *args) { + if (_stricmp(*args, "/on") == 0) { + if (ret != ERROR_SUCCESS) { + ret = VfdRegisterHandlers(); + + if (ret != ERROR_SUCCESS) { + PrintMessage(MSG_SET_SHELLEXT_NG); + printf("%s", SystemError(ret)); + return VFD_NG; + } + } + } + else if (_stricmp(*args, "/off") == 0) { + if (ret == ERROR_SUCCESS) { + ret = VfdUnregisterHandlers(); + + if (ret != ERROR_SUCCESS) { + PrintMessage(MSG_SET_SHELLEXT_NG); + printf("%s", SystemError(ret)); + return VFD_NG; + } + } + } + else { + PrintMessage(MSG_UNKNOWN_OPTION, *args); + PrintMessage(MSG_HINT_SHELL, help_progname); + return VFD_NG; + } + + ret = VfdCheckHandlers(); + } + + if (ret == ERROR_PATH_NOT_FOUND || + ret == ERROR_FILE_NOT_FOUND) { + PrintMessage(MSG_SHELLEXT_DISABLED); + } + else if (ret == ERROR_SUCCESS) { + PrintMessage(MSG_SHELLEXT_ENABLED); + } + else { + PrintMessage(MSG_GET_SHELLEXT_NG); + printf("%s", SystemError(ret)); + return VFD_NG; + } + + return VFD_OK; +} + +// +// Open an image file to a Virtual Floppy Drive +// Command Line Parameters: +// [drive:] [file] [/NEW] [/RAM] [/P | /W] +// [/size] [/media] [/F | /FORCE | /Q | /QUIT] + +int Open(const char **args) +{ + int mode = OPERATION_ASK; + BOOL create = FALSE; + ULONG target = TARGET_NONE; + PCSTR file_name = NULL; + VFD_DISKTYPE disk_type = VFD_DISKTYPE_FILE; + CHAR protect = '\0'; + VFD_MEDIA media_type = VFD_MEDIA_NONE; + BOOL five_inch = FALSE; + VFD_FLAGS media_flags = 0; + HANDLE hDevice; + CHAR letter; + DWORD ret; + + // process parameters + + while (args && *args) { + + if (!_stricmp(*args, "/f") || + !_stricmp(*args, "/force")) { + + if (mode != OPERATION_ASK) { + PrintMessage(MSG_DUPLICATE_ARGS, *args); + return VFD_NG; + } + + mode = OPERATION_FORCE; + } + else if (!_stricmp(*args, "/q") || + !_stricmp(*args, "/quit")) { + + if (mode != OPERATION_ASK) { + PrintMessage(MSG_DUPLICATE_ARGS, *args); + return VFD_NG; + } + + mode = OPERATION_QUIT; + } + + else if (!_stricmp(*args, "/new")) { + + if (create) { + PrintMessage(MSG_DUPLICATE_ARGS, *args); + return VFD_NG; + } + + create = TRUE; + } + + // Disk type options + + else if (_stricmp(*args, "/ram") == 0) { + + if (disk_type != VFD_DISKTYPE_FILE) { + PrintMessage(MSG_DUPLICATE_ARGS, *args); + return VFD_NG; + } + + disk_type = VFD_DISKTYPE_RAM; + } + + // Protect options + else if (_stricmp(*args, "/p") == 0 || + _stricmp(*args, "/w") == 0) { + + if (protect) { + PrintMessage(MSG_DUPLICATE_ARGS, *args); + return VFD_NG; + } + + protect = (CHAR)toupper(*(*args + 1)); + } + + // media size options + + else if (strcmp(*args, "/160") == 0) { + if (media_type) { + PrintMessage(MSG_DUPLICATE_ARGS, *args); + return VFD_NG; + } + + media_type = VFD_MEDIA_F5_160; + } + else if (strcmp(*args, "/180") == 0) { + if (media_type) { + PrintMessage(MSG_DUPLICATE_ARGS, *args); + return VFD_NG; + } + + media_type = VFD_MEDIA_F5_180; + } + else if (strcmp(*args, "/320") == 0) { + if (media_type) { + PrintMessage(MSG_DUPLICATE_ARGS, *args); + return VFD_NG; + } + + media_type = VFD_MEDIA_F5_320; + } + else if (strcmp(*args, "/360") == 0) { + if (media_type) { + PrintMessage(MSG_DUPLICATE_ARGS, *args); + return VFD_NG; + } + + media_type = VFD_MEDIA_F5_360; + } + else if (strcmp(*args, "/640") == 0) { + if (media_type) { + PrintMessage(MSG_DUPLICATE_ARGS, *args); + return VFD_NG; + } + + media_type = VFD_MEDIA_F3_640; + } + else if (strcmp(*args, "/720") == 0) { + if (media_type) { + PrintMessage(MSG_DUPLICATE_ARGS, *args); + return VFD_NG; + } + + media_type = VFD_MEDIA_F3_720; + } + else if (strcmp(*args, "/820") == 0) { + if (media_type) { + PrintMessage(MSG_DUPLICATE_ARGS, *args); + return VFD_NG; + } + + media_type = VFD_MEDIA_F3_820; + } + else if (strcmp(*args, "/120") == 0 || + strcmp(*args, "/1.20") == 0) { + if (media_type) { + PrintMessage(MSG_DUPLICATE_ARGS, *args); + return VFD_NG; + } + + media_type = VFD_MEDIA_F3_1P2; + } + else if (strcmp(*args, "/144") == 0 || + strcmp(*args, "/1.44") == 0) { + if (media_type) { + PrintMessage(MSG_DUPLICATE_ARGS, *args); + return VFD_NG; + } + + media_type = VFD_MEDIA_F3_1P4; + } + else if (strcmp(*args, "/168") == 0 || + strcmp(*args, "/1.68") == 0) { + if (media_type) { + PrintMessage(MSG_DUPLICATE_ARGS, *args); + return VFD_NG; + } + + media_type = VFD_MEDIA_F3_1P6; + } + else if (strcmp(*args, "/172") == 0 || + strcmp(*args, "/1.72") == 0) { + if (media_type) { + PrintMessage(MSG_DUPLICATE_ARGS, *args); + return VFD_NG; + } + + media_type = VFD_MEDIA_F3_1P7; + } + else if (strcmp(*args, "/288") == 0 || + strcmp(*args, "/2.88") == 0) { + if (media_type) { + PrintMessage(MSG_DUPLICATE_ARGS, *args); + return VFD_NG; + } + + media_type = VFD_MEDIA_F3_2P8; + } + + // 5.25 inch media + + else if (strcmp(*args, "/5") == 0 || + strcmp(*args, "/525") == 0 || + strcmp(*args, "/5.25") == 0) { + + if (five_inch) { + PrintMessage(MSG_DUPLICATE_ARGS, *args); + return VFD_NG; + } + + five_inch = TRUE; + } + + // target option + + else if (isalnum(**args) && + *(*args + 1) == ':' && + *(*args + 2) == '\0') { + + if (target != TARGET_NONE) { + PrintMessage(MSG_DUPLICATE_ARGS, *args); + return VFD_NG; + } + + target = toupper(**args); + } + + // filename + + else if (**args != '/') { + if (file_name) { + PrintMessage(MSG_DUPLICATE_ARGS, *args); + return VFD_NG; + } + + file_name = *args; + } + else { + PrintMessage(MSG_UNKNOWN_OPTION, *args); + PrintMessage(MSG_HINT_OPEN, help_progname); + return VFD_NG; + } + + args++; + } + + if (target == TARGET_NONE) { + // default target + target = '0'; + PrintMessage(MSG_TARGET_NOTICE, target); + } + + // check target file + + if (file_name) { + DWORD file_attr; + VFD_FILETYPE file_type; + ULONG image_size; + BOOL overwrite = FALSE; + + ret = VfdCheckImageFile( + file_name, &file_attr, &file_type, &image_size); + + if (ret == ERROR_FILE_NOT_FOUND) { + + // the target file does not exist + + if (!create) { // create option not specified + + if (mode == OPERATION_FORCE) { + PrintMessage(MSG_CREATE_NOTICE); + } + else { + printf("%s", SystemError(ret)); + + if (mode == OPERATION_QUIT || + InputChar(MSG_CREATE_CONFIRM, "yn") == 'n') { + return VFD_NG; + } + } + + create = TRUE; + } + } + else if (ret == ERROR_SUCCESS) { + + // the target file exists + + if (create) { // create option is specified + + if (mode == OPERATION_FORCE) { + PrintMessage(MSG_OVERWRITE_NOTICE); + } + else { + printf("%s", SystemError(ERROR_FILE_EXISTS)); + + if (mode == OPERATION_QUIT || + InputChar(MSG_OVERWRITE_CONFIRM, "yn") == 'n') { + return VFD_NG; + } + } + + overwrite = TRUE; + } + } + else { + PrintMessage(MSG_OPEN_NG, file_name); + printf("%s", SystemError(ret)); + return VFD_NG; + } + + // + // create or overwrite the target file + // + + if (create) { + + if (media_type == VFD_MEDIA_NONE) { + + if (mode == OPERATION_FORCE) { + PrintMessage(MSG_CREATE144_NOTICE); + } + else { + PrintMessage(MSG_FILE_MEDIA_UNKNOWN); + + if (mode == OPERATION_QUIT || + InputChar(MSG_CREATE144_CONFIRM, "yn") == 'n') { + return VFD_NG; + } + } + + media_type = VFD_MEDIA_F3_1P4; + } + + ret = VfdCreateImageFile( + file_name, media_type, VFD_FILETYPE_RAW, overwrite); + + if (ret != ERROR_SUCCESS) { + PrintMessage(MSG_CREATE_NG, file_name); + printf("%s", SystemError(ret)); + return VFD_NG; + } + + PrintMessage(MSG_FILE_CREATED); + + ret = VfdCheckImageFile( + file_name, &file_attr, &file_type, &image_size); + + if (ret != ERROR_SUCCESS) { + PrintMessage(MSG_OPEN_NG, file_name); + printf("%s", SystemError(ret)); + return VFD_NG; + } + } + else { + // + // use the existing target file + // check image size and the media type + // + + VFD_MEDIA def_media; // default media for image size + ULONG media_size; // specified media size + + media_size = VfdGetMediaSize(media_type); + + if (media_size > image_size) { + + // specified media is too large for the image + + PrintMessage(MSG_IMAGE_TOO_SMALL); + return VFD_NG; + } + + def_media = VfdLookupMedia(image_size); + + if (def_media == VFD_MEDIA_NONE) { + + // image is too small for the smallest media + + PrintMessage(MSG_IMAGE_TOO_SMALL); + return VFD_NG; + } + + if (media_type == VFD_MEDIA_NONE) { + + // media type is not specified + + ULONG def_size = VfdGetMediaSize(def_media); + + if (def_size != image_size) { + + // image size does not match the largest media size + + PrintMessage(MSG_NO_MATCHING_MEDIA, image_size); + + if (mode == OPERATION_FORCE) { + PrintMessage(MSG_MEDIATYPE_NOTICE, + VfdMediaTypeName(def_media), def_size); + } + else if (mode == OPERATION_QUIT) { + return VFD_NG; + } + else { + PrintMessage(MSG_MEDIATYPE_SUGGEST, + VfdMediaTypeName(def_media), def_size); + + if (InputChar(MSG_MEDIATYPE_CONFIRM, "yn") == 'n') { + return VFD_NG; + } + } + } + + media_type = def_media; + } + } + + // check file attributes against the disk type + + if (file_type == VFD_FILETYPE_ZIP || + (file_attr & (FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_COMPRESSED | FILE_ATTRIBUTE_ENCRYPTED))) { + + if (disk_type != VFD_DISKTYPE_RAM) { + + if (mode == OPERATION_FORCE) { + PrintMessage(MSG_RAM_MODE_NOTICE); + } + else { + PrintMessage(MSG_RAM_MODE_ONLY); + + if (mode == OPERATION_QUIT || + InputChar(MSG_RAM_MODE_CONFIRM, "yn") == 'n') { + return VFD_NG; + } + } + + disk_type = VFD_DISKTYPE_RAM; + } + } + + if (disk_type != VFD_DISKTYPE_FILE) { + if (!protect) { + PrintMessage(MSG_DEFAULT_PROTECT); + protect = 'P'; + } + } + } + else { + // + // pure RAM disk + // + disk_type = VFD_DISKTYPE_RAM; + + if (media_type == VFD_MEDIA_NONE) { + + if (mode == OPERATION_FORCE) { + PrintMessage(MSG_CREATE144_NOTICE); + } + else { + PrintMessage(MSG_RAM_MEDIA_UNKNOWN); + + if (mode == OPERATION_QUIT || + InputChar(MSG_CREATE144_CONFIRM, "yn") == 'n') { + return VFD_NG; + } + } + + media_type = VFD_MEDIA_F3_1P4; + } + } + + if (protect == 'P') { + media_flags |= VFD_FLAG_WRITE_PROTECTED; + } + + if (five_inch && + VfdGetMediaSize(media_type) == + VfdGetMediaSize((VFD_MEDIA)(media_type + 1))) { + media_type = (VFD_MEDIA)(media_type + 1); + } + + // ensure that the driver is installed + + if (driver_state == VFD_NOT_INSTALLED && + Install(NULL) != VFD_OK) { + return VFD_NG; + } + + // ensure that the driver is up to date + + if (CheckDriver() != VFD_OK) { + return VFD_NG; + } + + // ensure that the driver is running + + if (driver_state != SERVICE_RUNNING && + Start(NULL) != VFD_OK) { + return VFD_NG; + } + + // Open the target device + + hDevice = VfdOpenDevice(target); + + if (hDevice == INVALID_HANDLE_VALUE) { + ret = GetLastError(); + PrintMessage(MSG_ACCESS_NG, target); + printf("%s", SystemError(ret)); + return VFD_NG; + } + + // Ensure that the drive is empty + + ret = VfdGetMediaState(hDevice); + + if (ret != ERROR_NOT_READY) { + if (ret == ERROR_SUCCESS || + ret == ERROR_WRITE_PROTECT) { + PrintMessage(MSG_DRIVE_BUSY); + } + else { + PrintMessage(MSG_GET_MEDIA_NG); + printf("%s", SystemError(ret)); + } + + CloseHandle(hDevice); + return VFD_NG; + } + + // Open the image file + + ret = VfdOpenImage(hDevice, file_name, + disk_type, media_type, media_flags); + + if (ret != ERROR_SUCCESS) { + PrintMessage(MSG_OPEN_NG, file_name ? file_name : "<RAM>"); + printf("%s", SystemError(ret)); + + CloseHandle(hDevice); + return VFD_NG; + } + + // assign a drive letter if the drive has none + + VfdGetGlobalLink(hDevice, &letter); + + if (!isalpha(letter)) { + VfdGetLocalLink(hDevice, &letter); + } + + if (!isalpha(letter)) { + VfdSetLocalLink(hDevice, VfdChooseLetter()); + } + + // Get the actually opened image information. + + PrintImageInfo(hDevice); + + CloseHandle(hDevice); + + return VFD_OK; +} + +// +// Close the current virtual floppy image +// Command Line Parameters: +// drive number or drive letter +// /F | /FORCE | /Q | /QUIT +// +int Close(const char **args) +{ + ULONG mode = OPERATION_ASK; + + ULONG target_min = TARGET_NONE; + ULONG target_max = TARGET_NONE; + HANDLE hDevice; + + VFD_MEDIA media_type; + VFD_FLAGS media_flags; + + DWORD ret; + + // check parameterS + + while (args && *args) { + + if (!_stricmp(*args, "/f") || + !_stricmp(*args, "/force")) { + + if (mode != OPERATION_ASK) { + PrintMessage(MSG_DUPLICATE_ARGS, *args); + return VFD_NG; + } + + mode = OPERATION_FORCE; + } + else if (!_stricmp(*args, "/q") || + !_stricmp(*args, "/quit")) { + + if (mode != OPERATION_ASK) { + PrintMessage(MSG_DUPLICATE_ARGS, *args); + return VFD_NG; + } + + mode = OPERATION_QUIT; + } + else if ((isalnum(**args) || **args == '*') && + (*(*args + 1) == ':' || *(*args + 1) == '\0')) { + + if (target_min != TARGET_NONE) { + PrintMessage(MSG_DUPLICATE_ARGS, *args); + return VFD_NG; + } + + if (**args == '*') { + target_min = '0'; + target_max = '0' + VFD_MAXIMUM_DEVICES; + } + else { + target_min = toupper(**args); + target_max = target_min + 1; + } + } + else { + PrintMessage(MSG_UNKNOWN_OPTION, *args); + PrintMessage(MSG_HINT_CLOSE, help_progname); + return VFD_NG; + } + + args++; + } + + if (target_min == TARGET_NONE) { + // default target = drive 0 + target_min = '0'; + target_max = '1'; + PrintMessage(MSG_TARGET_NOTICE, target_min); + } + + // ensure that the driver is installed + + if (driver_state == VFD_NOT_INSTALLED) { + PrintMessage(MSG_NOT_INSTALLED); + return VFD_NG; + } + + // ensure that the driver is running + + if (driver_state != SERVICE_RUNNING) { + PrintMessage(MSG_NOT_STARTED); + return VFD_NG; + } + + // Close the drive(s) + + while (target_min < target_max) { + + // open the target device + + hDevice = VfdOpenDevice(target_min); + + if (hDevice == INVALID_HANDLE_VALUE) { + ret = GetLastError(); + + PrintMessage(MSG_ACCESS_NG, target_min); + printf("%s", SystemError(ret)); + + if (mode != OPERATION_FORCE) { + return VFD_NG; + } + + target_min++; + continue; + } + + // get the current image information + + ret = VfdGetImageInfo(hDevice, NULL, NULL, + &media_type, &media_flags, NULL, NULL); + + if (ret != ERROR_SUCCESS) { + PrintMessage(MSG_ACCESS_NG, target_min); + printf("%s", SystemError(ret)); + + CloseHandle(hDevice); + + if (mode != OPERATION_FORCE) { + return VFD_NG; + } + + target_min++; + continue; + } + + if (media_type == VFD_MEDIA_NONE) { + + // drive is empty + + CloseHandle(hDevice); + target_min++; + continue; + } + + if (media_flags & VFD_FLAG_DATA_MODIFIED) { + + // RAM disk data is modified + + PrintMessage(MSG_MEDIA_MODIFIED, target_min); + + if (mode == OPERATION_FORCE) { + PrintMessage(MSG_CLOSE_FORCE); + } + else if (mode == OPERATION_QUIT) { + PrintMessage(MSG_CLOSE_QUIT); + CloseHandle(hDevice); + return VFD_NG; + } + else { + if (InputChar(MSG_CLOSE_CONFIRM, "yn") == 'n') { + CloseHandle(hDevice); + return VFD_NG; + } + } + } + +retry: + ret = VfdCloseImage( + hDevice, (mode == OPERATION_FORCE)); + + if (ret == ERROR_ACCESS_DENIED) { + + PrintMessage(MSG_LOCK_NG, target_min); + + if (mode == OPERATION_QUIT) { + CloseHandle(hDevice); + return VFD_NG; + } + else if (mode == OPERATION_ASK) { + + int c; + + if (IS_WINDOWS_NT()) { + c = InputChar(MSG_RETRY_CANCEL, "rc"); + } + else { + c = InputChar(MSG_RETRY_FORCE_CANCEL, "rfc"); + } + + if (c == 'f') { // force + ret = VfdCloseImage(hDevice, TRUE); + } + else if (c == 'c') { // cancel + CloseHandle(hDevice); + return VFD_NG; + } + else { + goto retry; + } + } + } + + CloseHandle(hDevice); + + if (ret == ERROR_SUCCESS) { + PrintMessage(MSG_CLOSE_OK, target_min); + } + else if (ret != ERROR_NOT_READY) { + PrintMessage(MSG_CLOSE_NG, target_min); + printf("%s", SystemError(ret)); + + if (mode != OPERATION_FORCE) { + return VFD_NG; + } + } + + target_min++; + } + + return VFD_OK; +} + +// +// Save the current image into a file +// +int Save(const char **args) +{ + int mode = OPERATION_ASK; + ULONG target = TARGET_NONE; + CHAR file_name[MAX_PATH] = {0}; + BOOL overwrite = FALSE; + BOOL truncate = FALSE; + + HANDLE hDevice; + CHAR current[MAX_PATH] = {0}; + VFD_MEDIA media_type; + VFD_FLAGS media_flags; + VFD_FILETYPE file_type; + DWORD file_attr; + ULONG image_size; + DWORD ret; + + // check parameters + + while (args && *args) { + + if (!_stricmp(*args, "/f") || + !_stricmp(*args, "/force")) { + + if (mode != OPERATION_ASK) { + PrintMessage(MSG_DUPLICATE_ARGS, *args); + return VFD_NG; + } + + mode = OPERATION_FORCE; + } + else if (!_stricmp(*args, "/q") || + !_stricmp(*args, "/quit")) { + + if (mode != OPERATION_ASK) { + PrintMessage(MSG_DUPLICATE_ARGS, *args); + return VFD_NG; + } + + mode = OPERATION_QUIT; + } + else if (!_stricmp(*args, "/o") || + !_stricmp(*args, "/over")) { + + if (truncate || overwrite) { + PrintMessage(MSG_DUPLICATE_ARGS, *args); + return VFD_NG; + } + + overwrite = TRUE; + } + else if (!_stricmp(*args, "/t") || + !_stricmp(*args, "/trunc")) { + + if (truncate || overwrite) { + PrintMessage(MSG_DUPLICATE_ARGS, *args); + return VFD_NG; + } + + truncate = TRUE; + } + else if (isalnum(**args) && + *(*args + 1) == ':' && + *(*args + 2) == '\0') { + + if (target != TARGET_NONE) { + PrintMessage(MSG_DUPLICATE_ARGS, *args); + return VFD_NG; + } + + target = toupper(**args); + } + else if (**args == '/') { + PrintMessage(MSG_UNKNOWN_OPTION, *args); + PrintMessage(MSG_HINT_SAVE, help_progname); + return VFD_NG; + } + else { + strcpy(file_name, *args); + } + + args++; + } + + if (target == TARGET_NONE) { + target = '0'; + PrintMessage(MSG_TARGET_NOTICE, target); + } + + // ensure that the driver is installed + + if (driver_state == VFD_NOT_INSTALLED) { + PrintMessage(MSG_NOT_INSTALLED); + return VFD_NG; + } + + // ensure that the driver is up to date + + if (CheckDriver() != VFD_OK) { + return VFD_NG; + } + + // ensure that the driver is running + + if (driver_state != SERVICE_RUNNING) { + PrintMessage(MSG_NOT_STARTED); + return VFD_NG; + } + + // Open the target device + + hDevice = VfdOpenDevice(target); + + if (hDevice == INVALID_HANDLE_VALUE) { + ret = GetLastError(); + PrintMessage(MSG_ACCESS_NG, target); + printf("%s", SystemError(ret)); + return VFD_NG; + } + + // Get the current image info + + ret = VfdGetImageInfo(hDevice, current, NULL, + &media_type, &media_flags, NULL, NULL); + + if (ret != ERROR_SUCCESS) { + printf("%s", SystemError(ret)); + CloseHandle(hDevice); + return VFD_NG; + } + + if (media_type == VFD_MEDIA_NONE) { + printf("%s", SystemError(ERROR_NOT_READY)); + CloseHandle(hDevice); + return VFD_NG; + } + + if (file_name[0] == '\0') { + + if (current[0] == '\0') { + + PrintMessage(MSG_TARGET_REQUIRED); + CloseHandle(hDevice); + + return VFD_NG; + } + + strcpy(file_name, current); + } + + if (!_stricmp(file_name, current)) { + + // target is the current image file + + if (!(media_flags & VFD_FLAG_DATA_MODIFIED)) { + + // FILE disk (always up to date) or RAM disk is not modified + + PrintMessage(MSG_TARGET_UP_TO_DATE); + CloseHandle(hDevice); + + return VFD_OK; + } + + overwrite = TRUE; + } + + // check target file + + ret = VfdCheckImageFile(file_name, + &file_attr, &file_type, &image_size); + + if (ret == ERROR_SUCCESS) { + + if (!overwrite && !truncate) { + + if (mode == OPERATION_FORCE) { + PrintMessage(MSG_OVERWRITE_NOTICE); + overwrite = TRUE; + } + else if (mode == OPERATION_QUIT) { + printf("%s", SystemError(ERROR_FILE_EXISTS)); + CloseHandle(hDevice); + + return VFD_NG; + } + else { + int c; + + printf("%s", SystemError(ERROR_FILE_EXISTS)); + + c = InputChar(MSG_OVERWRITE_PROMPT, "otc"); + + if (c == 'o') { + overwrite = TRUE; + } + else if (c == 't') { + truncate = TRUE; + } + else { + CloseHandle(hDevice); + return VFD_NG; + } + } + } + } + else if (ret != ERROR_FILE_NOT_FOUND) { + + printf("%s", SystemError(ret)); + CloseHandle(hDevice); + + return VFD_NG; + } + + if (file_type == VFD_FILETYPE_ZIP) { + + // Cannot update a zip file + + PrintMessage(MSG_TARGET_IS_ZIP); + CloseHandle(hDevice); + + return VFD_NG; + } + +retry: + ret = VfdDismountVolume( + hDevice, (mode == OPERATION_FORCE)); + + if (ret == ERROR_ACCESS_DENIED) { + + PrintMessage(MSG_LOCK_NG, target); + + if (mode == OPERATION_FORCE) { + PrintMessage(MSG_SAVE_FORCE); + } + else if (mode == OPERATION_QUIT) { + PrintMessage(MSG_SAVE_QUIT); + CloseHandle(hDevice); + return VFD_NG; + } + else { + int c = InputChar(MSG_RETRY_FORCE_CANCEL, "rfc"); + + if (c == 'r') { // retry + goto retry; + } + else if (c == 'f') { // force + VfdDismountVolume(hDevice, TRUE); + } + else { // cancel + CloseHandle(hDevice); + return VFD_NG; + } + } + } + else if (ret != ERROR_SUCCESS) { + printf("%s", SystemError(ret)); + CloseHandle(hDevice); + return VFD_NG; + } + + ret = VfdSaveImage(hDevice, file_name, + (overwrite || truncate), truncate); + + CloseHandle(hDevice); + + if (ret != ERROR_SUCCESS) { + PrintMessage(MSG_SAVE_NG, target, file_name); + printf("%s", SystemError(ret)); + + return VFD_NG; + } + + PrintMessage(MSG_SAVE_OK, target, file_name); + + return VFD_OK; +} + +// +// Enable/disable virtual media write protection +// +int Protect(const char **args) +{ +#define PROTECT_NONE 0 +#define PROTECT_ON 1 +#define PROTECT_OFF 2 + ULONG protect = PROTECT_NONE; + ULONG target = TARGET_NONE; + HANDLE hDevice; + DWORD ret; + + // check parameters + + while (args && *args) { + + // Disk type options + + if (_stricmp(*args, "/on") == 0) { + + if (protect) { + PrintMessage(MSG_DUPLICATE_ARGS, *args); + return VFD_NG; + } + + protect = PROTECT_ON; + } + else if (_stricmp(*args, "/off") == 0) { + + if (protect) { + PrintMessage(MSG_DUPLICATE_ARGS, *args); + return VFD_NG; + } + + protect = PROTECT_OFF; + } + else if (isalnum(**args)) { + + if (target != TARGET_NONE) { + PrintMessage(MSG_DUPLICATE_ARGS, *args); + return VFD_NG; + } + + target = toupper(**args); + } + else { + PrintMessage(MSG_UNKNOWN_OPTION, *args); + PrintMessage(MSG_HINT_PROTECT, help_progname); + return VFD_NG; + } + + args++; + } + + if (target == TARGET_NONE) { + target = '0'; + PrintMessage(MSG_TARGET_NOTICE, target); + } + + // ensure that the driver is installed + + if (driver_state == VFD_NOT_INSTALLED) { + PrintMessage(MSG_NOT_INSTALLED); + return VFD_NG; + } + + // ensure that the driver is up to date + + if (CheckDriver() != VFD_OK) { + return VFD_NG; + } + + // ensure that the driver is running + + if (driver_state != SERVICE_RUNNING) { + PrintMessage(MSG_NOT_STARTED); + return VFD_NG; + } + + // open the target drive + + hDevice = VfdOpenDevice(target); + + if (hDevice == INVALID_HANDLE_VALUE) { + ret = GetLastError(); + PrintMessage(MSG_ACCESS_NG, target); + printf("%s", SystemError(ret)); + return VFD_NG; + } + + if (protect) { + // change protect state + + ret = VfdWriteProtect( + hDevice, (protect == PROTECT_ON)); + + if (ret != ERROR_SUCCESS) { + PrintMessage(MSG_PROTECT_NG, target); + printf("%s", SystemError(ret)); + + CloseHandle(hDevice); + return VFD_NG; + } + } + + // get the current protect state + + ret = VfdGetMediaState(hDevice); + + CloseHandle(hDevice); + + if (ret == ERROR_SUCCESS) { + PrintMessage(MSG_MEDIA_WRITABLE); + } + else if (ret == ERROR_WRITE_PROTECT) { + PrintMessage(MSG_MEDIA_PROTECTED); + } + else { + PrintMessage(MSG_GET_MEDIA_NG); + printf("%s", SystemError(ret)); + return VFD_NG; + } + + return VFD_OK; +} + +// +// Format the virtual media with FAT12 +// +int Format(const char **args) +{ + int mode = OPERATION_ASK; + ULONG target = TARGET_NONE; + HANDLE hDevice; + DWORD ret; + + // check parameters + + while (args && *args) { + + if (!_stricmp(*args, "/f") || + !_stricmp(*args, "/force")) { + + if (mode != OPERATION_ASK) { + PrintMessage(MSG_DUPLICATE_ARGS, *args); + return VFD_NG; + } + + mode = OPERATION_FORCE; + } + else if (!_stricmp(*args, "/q") || + !_stricmp(*args, "/quit")) { + + if (mode != OPERATION_ASK) { + PrintMessage(MSG_DUPLICATE_ARGS, *args); + return VFD_NG; + } + + mode = OPERATION_QUIT; + } + else if (isalnum(**args)) { + if (target != TARGET_NONE) { + PrintMessage(MSG_DUPLICATE_ARGS, *args); + return VFD_NG; + } + + target = toupper(**args); + } + else { + PrintMessage(MSG_UNKNOWN_OPTION, *args); + PrintMessage(MSG_HINT_FORMAT, help_progname); + return VFD_NG; + } + + args++; + } + + if (target == TARGET_NONE) { + target = '0'; + PrintMessage(MSG_TARGET_NOTICE, target); + } + + // ensure that the driver is installed + + if (driver_state == VFD_NOT_INSTALLED) { + PrintMessage(MSG_NOT_INSTALLED); + return VFD_NG; + } + + // ensure that the driver is up to date + + if (CheckDriver() != VFD_OK) { + return VFD_NG; + } + + // ensure that the driver is running + + if (driver_state != SERVICE_RUNNING) { + PrintMessage(MSG_NOT_STARTED); + return VFD_NG; + } + + // Open the device + + hDevice = VfdOpenDevice(target); + + if (hDevice == INVALID_HANDLE_VALUE) { + ret = GetLastError(); + PrintMessage(MSG_ACCESS_NG, target); + printf("%s", SystemError(ret)); + return VFD_NG; + } + + // check if the media is writable + + ret = VfdGetMediaState(hDevice); + + if (ret != ERROR_SUCCESS) { + PrintMessage(MSG_FORMAT_NG, target); + printf("%s", SystemError(ret)); + + CloseHandle(hDevice); + return VFD_NG; + } + + // format the media + +retry: + ret = VfdDismountVolume( + hDevice, (mode == OPERATION_FORCE)); + + if (ret == ERROR_ACCESS_DENIED) { + + PrintMessage(MSG_LOCK_NG, target); + + if (mode == OPERATION_FORCE) { + PrintMessage(MSG_FORMAT_FORCE); + } + else if (mode == OPERATION_QUIT) { + PrintMessage(MSG_FORMAT_QUIT); + CloseHandle(hDevice); + return VFD_NG; + } + else { + int c = InputChar(MSG_RETRY_FORCE_CANCEL, "rfc"); + + if (c == 'r') { // retry + goto retry; + } + else if (c == 'f') { // force + VfdDismountVolume(hDevice, TRUE); + } + else { // cancel + CloseHandle(hDevice); + return VFD_NG; + } + } + } + else if (ret != ERROR_SUCCESS) { + PrintMessage(MSG_LOCK_NG, target); + CloseHandle(hDevice); + return VFD_NG; + } + + ret = VfdFormatMedia(hDevice); + + CloseHandle(hDevice); + + if (ret != ERROR_SUCCESS) { + PrintMessage(MSG_FORMAT_NG, target); + printf("%s", SystemError(ret)); + return VFD_NG; + } + + // successful operation + + PrintMessage(MSG_FORMAT_OK); + + return VFD_OK; +} + +// +// Assign a drive letter to a Virtual Floppy Drive +// +int Link(const char **args) +{ + ULONG target_min = TARGET_NONE; + ULONG target_max = TARGET_NONE; + PCSTR letters = NULL; + BOOL global = TRUE; + HANDLE hDevice; + DWORD ret; + + while (args && *args) { + if (!_stricmp(*args, "/g")) { + global = TRUE; + } + else if (!_stricmp(*args, "/l")) { + global = FALSE; + } + else if (isdigit(**args) || **args == '*') { + if (target_min != TARGET_NONE) { + PrintMessage(MSG_DUPLICATE_ARGS, *args); + return VFD_NG; + } + + if (**args == '*') { + target_min = '0'; + target_max = '0' + VFD_MAXIMUM_DEVICES; + } + else { + target_min = **args; + target_max = target_min + 1; + } + } + else if (isalpha(**args)) { + if (letters) { + PrintMessage(MSG_DUPLICATE_ARGS, *args); + return VFD_NG; + } + letters = *args; + } + else { + PrintMessage(MSG_UNKNOWN_OPTION, *args); + PrintMessage(MSG_HINT_LINK, help_progname); + return VFD_NG; + } + + args++; + } + + if (target_min == TARGET_NONE) { + // default: drive 0 + target_min = '0'; + target_max = '1'; + PrintMessage(MSG_TARGET_NOTICE, target_min); + } + + // ensure that the driver is installed + + if (driver_state == VFD_NOT_INSTALLED) { + PrintMessage(MSG_NOT_INSTALLED); + return VFD_NG; + } + + // ensure that the driver is up to date + + if (CheckDriver() != VFD_OK) { + return VFD_NG; + } + + // ensure that the driver is running + + if (driver_state != SERVICE_RUNNING) { + PrintMessage(MSG_NOT_STARTED); + return VFD_NG; + } + + while (target_min < target_max) { + ULONG number; + CHAR letter; + + hDevice = VfdOpenDevice(target_min); + + if (hDevice == INVALID_HANDLE_VALUE) { + ret = GetLastError(); + PrintMessage(MSG_ACCESS_NG, target_min); + printf("%s", SystemError(ret)); + target_min++; + continue; + } + + ret = VfdGetDeviceNumber(hDevice, &number); + + if (ret != ERROR_SUCCESS) { + PrintMessage(MSG_ACCESS_NG, target_min); + printf("%s", SystemError(ret)); + CloseHandle(hDevice); + target_min++; + continue; + } + + if (letters && isalpha(*letters)) { + letter = (CHAR)toupper(*(letters++)); + } + else { + letter = VfdChooseLetter(); + } + + if (letter) { + if (global) { + ret = VfdSetGlobalLink(hDevice, letter); + } + else { + ret = VfdSetLocalLink(hDevice, letter); + } + + if (ret != ERROR_SUCCESS) { + PrintMessage(MSG_LINK_NG, number, letter); + printf("%s", SystemError(ret)); + } + } + else { + PrintMessage(MSG_LINK_FULL); + } + + PrintDriveLetter(hDevice, number); + + CloseHandle(hDevice); + + target_min++; + } + + return VFD_OK; +} + +// +// Remove a drive letter from a Virtual Floppy Drive +// +int Unlink(const char **args) +{ + ULONG target_min = TARGET_NONE; + ULONG target_max = TARGET_NONE; + HANDLE hDevice; + DWORD ret; + + while (args && *args) { + if ((isalnum(**args) || **args == '*') && + (*(*args + 1) == ':' || *(*args + 1) == '\0')) { + + if (target_min != TARGET_NONE) { + PrintMessage(MSG_DUPLICATE_ARGS, *args); + return VFD_NG; + } + + if (**args == '*') { + target_min = '0'; + target_max = '0' + VFD_MAXIMUM_DEVICES; + } + else { + target_min = **args; + target_max = target_min + 1; + } + } + else { + PrintMessage(MSG_UNKNOWN_OPTION, *args); + PrintMessage(MSG_HINT_ULINK, help_progname); + return VFD_NG; + } + + args++; + } + + if (target_min == TARGET_NONE) { + // default: drive 0 + target_min = '0'; + target_max = '1'; + PrintMessage(MSG_TARGET_NOTICE, target_min); + } + + // ensure that the driver is installed + + if (driver_state == VFD_NOT_INSTALLED) { + PrintMessage(MSG_NOT_INSTALLED); + return VFD_NG; + } + + // ensure that the driver is up to date + + if (CheckDriver() != VFD_OK) { + return VFD_NG; + } + + // ensure that the driver is running + + if (driver_state != SERVICE_RUNNING) { + PrintMessage(MSG_NOT_STARTED); + return VFD_NG; + } + + while (target_min < target_max) { + ULONG number; + + hDevice = VfdOpenDevice(target_min); + + if (hDevice == INVALID_HANDLE_VALUE) { + ret = GetLastError(); + PrintMessage(MSG_ACCESS_NG, target_min); + printf("%s", SystemError(ret)); + target_min++; + continue; + } + + ret = VfdGetDeviceNumber(hDevice, &number); + + if (ret != ERROR_SUCCESS) { + PrintMessage(MSG_ACCESS_NG, target_min); + printf("%s", SystemError(ret)); + CloseHandle(hDevice); + target_min++; + continue; + } + + VfdSetGlobalLink(hDevice, 0); + VfdSetLocalLink(hDevice, 0); + + PrintDriveLetter(hDevice, number); + + CloseHandle(hDevice); + + target_min++; + } + + return VFD_OK; +} + +// +// Print current driver state +// Command Line Parameters: None +// +int Status(const char **args) +{ + HANDLE hDevice; + TCHAR path[MAX_PATH]; + DWORD start_type; + DWORD version; + ULONG target; + DWORD ret; + + UNREFERENCED_PARAMETER(args); + + if (driver_state == VFD_NOT_INSTALLED) { + PrintMessage(MSG_NOT_INSTALLED); + } + else { + + // get current driver config + + ret = VfdGetDriverConfig(path, &start_type); + + if (ret != ERROR_SUCCESS) { + PrintMessage(MSG_GET_CONFIG_NG); + printf("%s", SystemError(ret)); + return VFD_NG; + } + + // print driver file path + + PrintMessage(MSG_DRIVER_FILE, path); + + // print driver version + version = 0; + + if (driver_state == SERVICE_RUNNING) { + + hDevice = VfdOpenDevice(0); + + if (hDevice != INVALID_HANDLE_VALUE) { + ret = VfdGetDriverVersion(hDevice, &version); + + CloseHandle(hDevice); + } + + } + + if (version == 0) { + ret = VfdCheckDriverFile(path, &version); + } + + if (ret == ERROR_SUCCESS) { + PrintMessage(MSG_DRIVER_VERSION, + HIWORD(version) & 0x7fff, + LOWORD(version), + (version & 0x80000000) ? "(debug)" : ""); + } + else { + PrintMessage(MSG_GET_VERSION_NG); + printf("%s", SystemError(ret)); + } + + + // print driver start type + + PrintMessage(MSG_START_TYPE); + + switch (start_type) { + case SERVICE_AUTO_START: + PrintMessage(MSG_START_AUTO); + break; + + case SERVICE_BOOT_START: + PrintMessage(MSG_START_BOOT); + break; + + case SERVICE_DEMAND_START: + PrintMessage(MSG_START_DEMAND); + break; + + case SERVICE_DISABLED: + PrintMessage(MSG_START_DISABLED); + break; + + case SERVICE_SYSTEM_START : + PrintMessage(MSG_START_SYSTEM); + break; + + default: + PrintMessage(MSG_UNKNOWN_LONG, start_type); + break; + } + + // print current driver state + + PrintMessage(MSG_DRIVER_STATUS); + + switch (driver_state) { + case SERVICE_STOPPED: + PrintMessage(MSG_STATUS_STOPPED); + break; + + case SERVICE_START_PENDING: + PrintMessage(MSG_STATUS_START_P); + break; + + case SERVICE_STOP_PENDING: + PrintMessage(MSG_STATUS_STOP_P); + break; + + case SERVICE_RUNNING: + PrintMessage(MSG_STATUS_RUNNING); + break; + + case SERVICE_CONTINUE_PENDING: + PrintMessage(MSG_STATUS_CONT_P); + break; + + case SERVICE_PAUSE_PENDING: + PrintMessage(MSG_STATUS_PAUSE_P); + break; + + case SERVICE_PAUSED: + PrintMessage(MSG_STATUS_PAUSED); + break; + + default: + PrintMessage(MSG_UNKNOWN_LONG, driver_state); + break; + } + } + + // print shell extension status + + printf("\n"); + + if (VfdCheckHandlers() == ERROR_SUCCESS) { + PrintMessage(MSG_SHELLEXT_ENABLED); + } + else { + PrintMessage(MSG_SHELLEXT_DISABLED); + } + + // if driver is not running, no more info + + if (driver_state != SERVICE_RUNNING) { + return VFD_OK; + } + + // print image information + + for (target = 0; target < VFD_MAXIMUM_DEVICES; target++) { + HANDLE hDevice = VfdOpenDevice(target); + + if (hDevice == INVALID_HANDLE_VALUE) { + ret = GetLastError(); + PrintMessage(MSG_ACCESS_NG, target + '0'); + printf("%s", SystemError(ret)); + return VFD_NG; + } + + PrintImageInfo(hDevice); + + CloseHandle(hDevice); + } + + return VFD_OK; +} + +// +// Print usage help +// +int Help(const char **args) +{ + DWORD msg = MSG_HELP_GENERAL; + char *buf = NULL; + + if (args && *args) { + int cmd = ParseHelpTopic(*args); + + if (cmd < 0) { + msg = MSG_HELP_HELP; + } + else { + msg = HelpMsg[cmd].help; + } + } + + FormatMessage( + FORMAT_MESSAGE_FROM_HMODULE | + FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_ARGUMENT_ARRAY, + NULL, msg, 0, (LPTSTR)&buf, 0, + (va_list *)&help_progname); + + if (buf == NULL) { + printf("%s", SystemError(GetLastError())); + return VFD_NG; + } + + ConsolePager(buf, TRUE); + LocalFree(buf); + + return VFD_OK; +} + +// +// Print version information +// +int Version(const char **args) +{ + UNREFERENCED_PARAMETER(args); + + printf(VFD_PRODUCT_DESC "\n" VFD_COPYRIGHT_STR "\n" + "
http://chitchat.at.infoseek.co.jp/vmware/vfd.html\n
"); + + return VFD_OK; +} + +// +// Parse command parameter +// +int ParseCommand(const char *cmd) +{ +#define CMD_MATCH_NONE -1 +#define CMD_MATCH_MULTI -2 + + size_t len; + int idx; + int match; + + // skip a leading '/' + + if (*cmd == '/') { + cmd++; + } + + if (*cmd == '\0') { + + // empty command + + return CMD_MATCH_NONE; + } + + // find a match + len = strlen(cmd); + idx = 0; + match = CMD_MATCH_NONE; + + while (Commands[idx].cmd) { + + if (strlen(Commands[idx].cmd) >= len && + !_strnicmp(cmd, Commands[idx].cmd, len)) { + + if (match == CMD_MATCH_NONE) { // first match + match = idx; + } + else { // multiple matches + if (match != CMD_MATCH_MULTI) { // first time + PrintMessage(MSG_AMBIGUOUS_COMMAND, cmd); + printf("> %s ", Commands[match].cmd); + match = CMD_MATCH_MULTI; + } + + printf("%s ", Commands[idx].cmd); + } + } + + idx++; + } + + if (match == CMD_MATCH_NONE) { // match not found + PrintMessage(MSG_UNKNOWN_COMMAND, cmd); + } + else if (match == CMD_MATCH_MULTI) { // multiple matches + printf("\n"); + } + + return match; +} + +int ParseHelpTopic(const char *topic) +{ + size_t len; + int idx; + int match; + + if (*topic == '\0') { + + // empty command + + return CMD_MATCH_NONE; + } + + // find a match + len = strlen(topic); + idx = 0; + match = CMD_MATCH_NONE; + + while (HelpMsg[idx].keyword) { + + if (strlen(HelpMsg[idx].keyword) >= len && + !_strnicmp(topic, HelpMsg[idx].keyword, len)) { + + if (match == CMD_MATCH_NONE) { // first match + match = idx; + } + else { // multiple matches + if (match != CMD_MATCH_MULTI) { // first time + PrintMessage(MSG_AMBIGUOUS_COMMAND, topic); + printf("> %s ", HelpMsg[match].keyword); + match = CMD_MATCH_MULTI; + } + + printf("%s ", HelpMsg[idx].keyword); + } + } + + idx++; + } + + if (match == CMD_MATCH_NONE) { // match not found + PrintMessage(MSG_UNKNOWN_COMMAND, topic); + } + else if (match == CMD_MATCH_MULTI) { // multiple matches + printf("\n"); + } + + return match; +} + +// +// Check driver version and update if necessary +// +int CheckDriver() +{ + char path[MAX_PATH]; + DWORD start; + + // check installed driver file version + + if (VfdGetDriverConfig(path, &start) == ERROR_SUCCESS && + VfdCheckDriverFile(path, NULL) == ERROR_SUCCESS) { + + HANDLE hDevice; + + if (driver_state != SERVICE_RUNNING) { + return VFD_OK; + } + + // check running driver version + + hDevice = VfdOpenDevice(0); + + if (hDevice != INVALID_HANDLE_VALUE) { + CloseHandle(hDevice); + return VFD_OK; + } + } + + PrintMessage(MSG_WRONG_DRIVER); + return VFD_NG; +} + +// +// Print a prompt message and accept the reply input +// +int InputChar(ULONG msg, PCSTR ans) +{ + HANDLE hStdIn; + INPUT_RECORD input; + DWORD result; + int reply; + + PrintMessage(msg); + fflush(NULL); + + hStdIn = GetStdHandle(STD_INPUT_HANDLE); + + FlushConsoleInputBuffer(hStdIn); + + for (;;) { + ReadConsoleInput(hStdIn, &input, sizeof(input), &result); + + if (input.EventType == KEY_EVENT && + input.Event.KeyEvent.bKeyDown) { + + reply = tolower(input.Event.KeyEvent.uChar.AsciiChar); + + if (strchr(ans, reply)) { + break; + } + } + } + + printf("%c\n", reply); + + return reply; +} + +// +// Print image information on a Virtual Floppy Drive +// +void PrintImageInfo( + HANDLE hDevice) +{ + ULONG device_number; + CHAR file_name[MAX_PATH]; + CHAR file_desc[MAX_PATH]; + VFD_DISKTYPE disk_type; + VFD_MEDIA media_type; + VFD_FLAGS media_flags; + VFD_FILETYPE file_type; + ULONG image_size; + DWORD ret; + + printf("\n"); + + // get current device number + + ret = VfdGetDeviceNumber(hDevice, &device_number); + + if (ret != ERROR_SUCCESS) { + PrintMessage(MSG_GET_LINK_NG); + printf("%s", SystemError(ret)); + device_number = (ULONG)-1; + } + + // get current drive letters + + PrintDriveLetter(hDevice, device_number); + + // image file information + + ret = VfdGetImageInfo(hDevice, file_name, &disk_type, + &media_type, &media_flags, &file_type, &image_size); + + if (ret != ERROR_SUCCESS) { + PrintMessage(MSG_GET_FILE_NG); + printf("%s", SystemError(ret)); + return; + } + + // print image file information + if (media_type == VFD_MEDIA_NONE) { + PrintMessage(MSG_IMAGE_NONE); + return; + } + + if (file_name[0]) { + PrintMessage(MSG_IMAGE_NAME, file_name); + + VfdMakeFileDesc(file_desc, sizeof(file_desc), + file_type, image_size, GetFileAttributes(file_name)); + } + else { + PrintMessage(MSG_IMAGE_NAME, "<RAM>"); + + VfdMakeFileDesc(file_desc, sizeof(file_desc), + VFD_FILETYPE_NONE, image_size, 0); + } + + PrintMessage(MSG_FILE_DESC, file_desc); + + if (disk_type == VFD_DISKTYPE_FILE) { + PrintMessage(MSG_DISKTYPE_FILE); + } + else { + if (media_flags & VFD_FLAG_DATA_MODIFIED) { + PrintMessage(MSG_DISKTYPE_RAM_DIRTY); + } + else { + PrintMessage(MSG_DISKTYPE_RAM_CLEAN); + } + } + + // print other file info + + PrintMessage(MSG_MEDIA_TYPE, VfdMediaTypeName(media_type)); + + if (media_flags & VFD_FLAG_WRITE_PROTECTED) { + PrintMessage(MSG_MEDIA_PROTECTED); + } + else { + PrintMessage(MSG_MEDIA_WRITABLE); + } +} + +// +// Print drive letters on a virtual floppy drive +// +void PrintDriveLetter( + HANDLE hDevice, + ULONG nDrive) +{ + CHAR letter; + + PrintMessage(MSG_DRIVE_LETTER, nDrive); + + VfdGetGlobalLink(hDevice, &letter); + + if (isalpha(letter)) { + PrintMessage(MSG_PERSISTENT, toupper(letter)); + } + + while (VfdGetLocalLink(hDevice, &letter) == ERROR_SUCCESS && + isalpha(letter)) { + PrintMessage(MSG_EPHEMERAL, toupper(letter)); + } + + printf("\n"); +} + +// +// Prints a text on screen a page a time +// +BOOL ConsolePager(char *pBuffer, BOOL bReset) +{ + static int rows = 0; + char prompt[80]; + int prompt_len = 0; + HANDLE hStdOut; + HANDLE hStdIn; + + // + // prepare the console input and output handles + // + hStdOut = GetStdHandle(STD_OUTPUT_HANDLE); + hStdIn = GetStdHandle(STD_INPUT_HANDLE); + + for (;;) { + CONSOLE_SCREEN_BUFFER_INFO info; + INPUT_RECORD input; + DWORD result; + DWORD mode; + int cols; + char *cur; + char save; + + // + // Get the current console screen information + // + GetConsoleScreenBufferInfo(hStdOut, &info); + + if (bReset || rows <= 0) { + rows = info.srWindow.Bottom - info.srWindow.Top - 1; + } + + cols = info.dwSize.X; + + // console window is too small for paging + + if (rows <= 0) { + // print all text and exit + printf("%s", pBuffer); + break; + } + + // + // find the tail of the text to be printed this time + // + cur = pBuffer; + save = '\0'; + + while (*cur) { + if (*(cur++) == '\n' || (cols--) == 0) { + // reached the end of a line + if (--rows == 0) { + // reached the end of a page + // insert a terminating NULL char + save = *cur; + *cur = '\0'; + break; + } + + cols = info.dwSize.X; + } + } + + // print the current page + printf("%s", pBuffer); + + // end of the whole text? + if (save == '\0') { + break; + } + + // + // prompt for the next page + // + + // prepare the prompt text + + if (prompt_len == 0) { + + prompt_len = FormatMessage( + FORMAT_MESSAGE_FROM_HMODULE | + FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, MSG_PAGER_PROMPT, 0, + prompt, sizeof(prompt), NULL); + + if (prompt_len == 0) { + strcpy(prompt, "Press any key to continue..."); + prompt_len = strlen(prompt); + } + } + + // get the current console input mode + + GetConsoleMode(hStdIn, &mode); + + // change the mode to receive Ctrl+C as a regular input + + SetConsoleMode(hStdIn, (mode & ~ENABLE_PROCESSED_INPUT)); + + // get the current cursor position + + GetConsoleScreenBufferInfo(hStdOut, &info); + + // print the prompt text + + WriteConsoleOutputCharacter(hStdOut, prompt, + prompt_len, info.dwCursorPosition, &result); + + // reverse the text color + + FillConsoleOutputAttribute(hStdOut, + (WORD)(info.wAttributes | COMMON_LVB_REVERSE_VIDEO), + prompt_len, info.dwCursorPosition, &result); + + // move cursor to the end of the prompt text + + info.dwCursorPosition.X = + (short)(info.dwCursorPosition.X + prompt_len); + + SetConsoleCursorPosition(hStdOut, info.dwCursorPosition); + + // wait for a key press event + + FlushConsoleInputBuffer(hStdIn); + + do { + ReadConsoleInput(hStdIn, &input, sizeof(input), &result); + } + while (input.EventType != KEY_EVENT || + !input.Event.KeyEvent.bKeyDown || + !input.Event.KeyEvent.uChar.AsciiChar); + + // restore the original cursor position + + info.dwCursorPosition.X = + (short)(info.dwCursorPosition.X - prompt_len); + + SetConsoleCursorPosition(hStdOut, info.dwCursorPosition); + + // delete the prompt text + + FillConsoleOutputCharacter(hStdOut, ' ', + prompt_len, info.dwCursorPosition, &result); + + // restore the text attribute to norml + + FillConsoleOutputAttribute(hStdOut, info.wAttributes, + prompt_len, info.dwCursorPosition, &result); + + // restore the original console mode + + SetConsoleMode(hStdIn, mode); + + // check if the input was 'q', <esc> or <Ctrl+C> ? + + if (input.Event.KeyEvent.uChar.AsciiChar == VK_CANCEL || + input.Event.KeyEvent.uChar.AsciiChar == VK_ESCAPE || + tolower(input.Event.KeyEvent.uChar.AsciiChar) == 'q') { + + // cancelled by the user + return FALSE; + } + + // + // process the next page + // + *cur = save; + pBuffer = cur; + } + + return TRUE; +} + +// +// Format and print a message text +// +void PrintMessage(UINT msg, ...) +{ + char *buf = NULL; + va_list list; + + va_start(list, msg); + + if (FormatMessage( + FORMAT_MESSAGE_FROM_HMODULE | + FORMAT_MESSAGE_ALLOCATE_BUFFER, + NULL, msg, 0, (LPTSTR)&buf, 0, &list)) { + + printf("%s", buf); + } + else { + printf("Unknown Message ID %u\n", msg); + } + + va_end(list); + + if (buf) { + LocalFree(buf); + } +} + +// +// Return a system error message text +// +const char *SystemError(DWORD err) +{ + static char msg[256]; + + if (!FormatMessage( + FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, err, 0, msg, sizeof(msg), NULL)) { +#ifndef __REACTOS__ + sprintf(msg, "Unknown system error %lu (0x%08x)\n", err, err); +#else + sprintf(msg, "Unknown system error %lu (0x%08lx)\n", err, err); +#endif + } + + return msg; +} + +// +// Convert a path to match the case of names on the disk +// +void ConvertPathCase(char *src, char *dst) +{ + HANDLE hFind; + WIN32_FIND_DATA find; + char *p; + + p = dst; + + if (*src == '\"') { + src++; + } + + if (*(src + strlen(src) - 1) == '\"') { + *(src + strlen(src) - 1) = '\0'; + } + + // + // handle drive / remote server name + // + if (isalpha(*src) && *(src + 1) == ':') { + + // drive name + + *(p++) = (char)toupper(*src); + strcpy(p++, ":\\"); + + src += 2; + } + else if (*src == '\\' || *src == '/') { + + // absolute path or remote name + + if ((*(src + 1) == '\\' || *(src + 1) == '/') && + *(src + 2) && *(src + 2) != '\\' && *(src + 2) != '/') { + + // remote path + + *(p++) = '\\'; + *(p++) = '\\'; + src += 2; + + while (*src && *src != '\\' && *src != '/') { + *(p++) = *(src++); + } + } + + strcpy(p, "\\"); + } + else { + *p = '\0'; + } + + // skip redundant '\' + + while (*src == '\\' || *src == '/') { + src++; + } + + // process the path + + while (*src) { + + char *q = src; + + // separate the next part + + while (*q && *q != '\\' && *q != '/') { + q++; + } + + if ((q - src) == 2 && !strncmp(src, "..", 2)) { + // parent dir - copy as it is + if (p != dst) { + *p++ = '\\'; + } + + strcpy(p, ".."); + p += 2; + } + else if ((q - src) > 1 || *src != '.') { + // path name other than "." + if (p != dst) { + *(p++) = '\\'; + } + + strncpy(p, src, (q - src)); + *(p + (q - src)) = '\0'; + + hFind = FindFirstFile(dst, &find); + + if (hFind == INVALID_HANDLE_VALUE) { + strcpy(p, src); + break; + } + + FindClose(hFind); + + strcpy(p, find.cFileName); + p += strlen(p); + } + + // skip trailing '\'s + + while (*q == '\\' || *q == '/') { + q++; + } + + src = q; + } +} diff --git a/modules/rosapps/applications/cmdutils/vfdcmd/vfdcmd.rc b/modules/rosapps/applications/cmdutils/vfdcmd/vfdcmd.rc new file mode 100644 index 0000000000..6f4b582bdd --- /dev/null +++ b/modules/rosapps/applications/cmdutils/vfdcmd/vfdcmd.rc @@ -0,0 +1,6 @@ +#define REACTOS_STR_FILE_DESCRIPTION "Virtual Floppy Controler" +#define REACTOS_STR_INTERNAL_NAME "vfdcmd" +#define REACTOS_STR_ORIGINAL_FILENAME "vfdcmd.exe" +#include <reactos/version.rc> + +#include <vfdmsg.rc> diff --git a/modules/rosapps/applications/cmdutils/vfdcmd/vfdcmd.rs b/modules/rosapps/applications/cmdutils/vfdcmd/vfdcmd.rs new file mode 100644 index 0000000000..3956ecc835 --- /dev/null +++ b/modules/rosapps/applications/cmdutils/vfdcmd/vfdcmd.rs @@ -0,0 +1,49 @@ +/* + vfdcmd.rs + + Virtual Floppy Drive for Windows + Driver control program (console version) + Resource script + + The non-standard extension ".rs" is intentional, so that + Microsoft Visual Studio won't try to open this file with + the resource editor + + Copyright (c) 2003-2005 Ken Kato +*/ + +#ifndef APSTUDIO_INVOKED + +// +// version resource +// +#include <winver.h> +#include "vfdver.h" + +#define VFD_FILEOS VOS_NT_WINDOWS32 +#define VFD_FILETYPE VFT_APP +#define VFD_FILESUBTYPE VFT2_UNKNOWN + +#define VFD_DESCRIPTION "Virtual Floppy Drive Console" +#define VFD_INTERNALNAME "vfd.exe" +#define VFD_FILE_MAJOR 2 +#define VFD_FILE_MINOR 1 + +// +// for Japanese version resources +// +#define VFD_VERSIONINFO_ALT "041104B0" +#undef VFD_VERSIONINFO_TRANS +#define VFD_VERSIONINFO_TRANS 0x0409, 0x04B0, 0x0411, 0x04B0 + +#define VFD_DESCRIPTION_ALT "Virtual Floppy Drive �R���\�[��" +#define VFD_PRODUCT_NAME_ALT VFD_PRODUCT_NAME + +#include "vfdver.rc" + +// +// Message resource +// +#include "vfdmsg.rc" + +#endif // not APSTUDIO_INVOKED diff --git a/modules/rosapps/applications/cmdutils/vfdcmd/vfdmsg.mc b/modules/rosapps/applications/cmdutils/vfdcmd/vfdmsg.mc new file mode 100644 index 0000000000..222c04d761 --- /dev/null +++ b/modules/rosapps/applications/cmdutils/vfdcmd/vfdmsg.mc @@ -0,0 +1,1596 @@ +;/* +; vfdmsg.h +; +; Virtual Floppy Drive for Windows +; Driver control program (console version) +; Message definition +; +; Copyright (C) 2003-2005 Ken Kato +;*/ +; +;#ifndef _VFDMSG_H_ +;#define _VFDMSG_H_ +; + +MessageIdTypedef=DWORD +LanguageNames=(English=0x409:MSG0409) + +;//============================================== +;// Generic error messages +;//============================================== +; + +MessageId= +SymbolicName=MSG_WRONG_PLATFORM +Language=English +Virtual Floppy Drive does not run on Windows 95/98/Me. +. + + +MessageId= +SymbolicName=MSG_TOO_MANY_ARGS +Language=English +Too many command line parameters. +. + + +MessageId= +SymbolicName=MSG_UNKNOWN_COMMAND +Language=English +Command '%1!s!' is unknown. +. + + +MessageId= +SymbolicName=MSG_AMBIGUOUS_COMMAND +Language=English +Command '%1!s!' is ambiguous. +. + + +MessageId= +SymbolicName=MSG_UNKNOWN_OPTION +Language=English +Option '%1!s!' is unknown. +. + + +MessageId= +SymbolicName=MSG_DUPLICATE_ARGS +Language=English +Parameter %1!s! is used more than once. +. + + +;//============================================== +;// Command result message +;//============================================== +; + +MessageId= +SymbolicName=MSG_INSTALL_OK +Language=English +Installed the Virtual Floppy driver. +. + + +MessageId= +SymbolicName=MSG_INSTALL_NG +Language=English +Failed to install the Virtual Floppy driver. +. + + +MessageId= +SymbolicName=MSG_CONFIG_OK +Language=English +Configured the Virtual Floppy driver start method. +. + + +MessageId= +SymbolicName=MSG_CONFIG_NG +Language=English +Failed to configure the Virtual Floppy driver start method. +. + + +MessageId= +SymbolicName=MSG_REMOVE_OK +Language=English +Uninstalled the Virtual Floppy driver. +. + + +MessageId= +SymbolicName=MSG_REMOVE_NG +Language=English +Failed to uninstall the Virtual Floppy driver. +. + + +MessageId= +SymbolicName=MSG_REMOVE_PENDING +Language=English +The Virtual Floppy driver is going to be removed on the next system start up. +You may need to restart the system before installing the driver again. +. + + +MessageId= +SymbolicName=MSG_START_OK +Language=English +Started the Virtual Floppy driver. +. + + +MessageId= +SymbolicName=MSG_START_NG +Language=English +Failed to start the Virtual Floppy driver. +. + + +MessageId= +SymbolicName=MSG_STOP_OK +Language=English +Stopped the Virtual Floppy driver. +. + + +MessageId= +SymbolicName=MSG_STOP_NG +Language=English +Failed to stop the Virtual Floppy driver. +. + + +MessageId= +SymbolicName=MSG_STOP_PENDING +Language=English +Stop operation has succeeded, but something +is preventing the driver from actually stopping. +You may need to reboot the system before restarting the driver. +. + + +MessageId= +SymbolicName=MSG_GET_SHELLEXT_NG +Language=English +Failed to get the shell extension status. +. + + +MessageId= +SymbolicName=MSG_SET_SHELLEXT_NG +Language=English +Failed to set the shell extension status. +. + + +MessageId= +SymbolicName=MSG_SHELLEXT_ENABLED +Language=English +Shell extension is enabled. +. + + +MessageId= +SymbolicName=MSG_SHELLEXT_DISABLED +Language=English +Shell extension is disabled. +. + + +MessageId= +SymbolicName=MSG_OPEN_NG +Language=English +Failed to open the image '%1!s!'. +. + + +MessageId= +SymbolicName=MSG_CLOSE_OK +Language=English +Closed the image on the drive %1!c!. +. + + +MessageId= +SymbolicName=MSG_CLOSE_NG +Language=English +Failed to close the image on the drive %1!c!. +. + + +MessageId= +SymbolicName=MSG_SAVE_OK +Language=English +Saved the image on the drive %1!c! into '%2!s!'. +. + + +MessageId= +SymbolicName=MSG_SAVE_NG +Language=English +Failed to save the image on the drive %1!c! into '%2!s!'. +. + + +MessageId= +SymbolicName=MSG_PROTECT_NG +Language=English +Failed to set write protect state on the drive %1!c!. +. + + +MessageId= +SymbolicName=MSG_FORMAT_OK +Language=English +Format complete. +. + + +MessageId= +SymbolicName=MSG_FORMAT_NG +Language=English +Failed to format the drive %1!c!. +. + + +MessageId= +SymbolicName=MSG_LINK_NG +Language=English +Failed to assign '%2!c!' to the drive %1!lu!. +. + + +MessageId= +SymbolicName=MSG_UNLINK_NG +Language=English +Failed to unlink the letter from the drive %1!lu!. +. + + +;//============================================== +;// Supplemental result message +;//============================================== +; + +MessageId= +SymbolicName=MSG_GET_STAT_NG +Language=English +Failed to get the driver status. +. + + +MessageId= +SymbolicName=MSG_GET_CONFIG_NG +Language=English +Failed to get the driver configuration. +. + + +MessageId= +SymbolicName=MSG_GET_VERSION_NG +Language=English +Failed to get the driver version. +. + + +MessageId= +SymbolicName=MSG_WRONG_DRIVER +Language=English +A wrong driver is installed. +. + + +MessageId= +SymbolicName=MSG_QUERY_UPDATE +Language=English +Update now (y / n) ? %0 +. + + +MessageId= +SymbolicName=MSG_GET_MEDIA_NG +Language=English +Failed to get the current media status. +. + + +MessageId= +SymbolicName=MSG_GET_FILE_NG +Language=English +Failed to get the image information. +. + + +MessageId= +SymbolicName=MSG_GET_LINK_NG +Language=English +Failed to get the current drive letter. +. + + +MessageId= +SymbolicName=MSG_LINK_FULL +Language=English +No drive letter is available. +. + + +MessageId= +SymbolicName=MSG_ACCESS_NG +Language=English +Failed to access the drive %1!c!. +. + + +MessageId= +SymbolicName=MSG_DRIVER_EXISTS +Language=English +The Virtual Floppy driver is already installed. +. + + +MessageId= +SymbolicName=MSG_NOT_INSTALLED +Language=English +The Virtual Floppy driver is not installed. +. + + +MessageId= +SymbolicName=MSG_ALREADY_RUNNING +Language=English +The Virtual Floppy driver is already running. +. + + +MessageId= +SymbolicName=MSG_NOT_STARTED +Language=English +The Virtual Floppy driver is not running. +. + + +MessageId= +SymbolicName=MSG_TARGET_NOTICE +Language=English +Using the default drive (%1!c!). +. + + +MessageId= +SymbolicName=MSG_CREATE_NOTICE +Language=English +Creating a new image file. +. + + +MessageId= +SymbolicName=MSG_CREATE_CONFIRM +Language=English +Create a new image file (Y:yes / N:no) ? %0 +. + + +MessageId= +SymbolicName=MSG_OVERWRITE_NOTICE +Language=English +Overwriting the existing file. +. + + +MessageId= +SymbolicName=MSG_OVERWRITE_CONFIRM +Language=English +Overwrite the existing file (Y:yes / N:no) ? %0 +. + + +MessageId= +SymbolicName=MSG_CREATE_NG +Language=English +Failed to create the new image file '%1!s!'. +. + + +MessageId= +SymbolicName=MSG_FILE_CREATED +Language=English +Created a new image file. +. + + +MessageId= +SymbolicName=MSG_RAM_MEDIA_UNKNOWN +Language=English +A size is not specified for a new RAM image. +. + + +MessageId= +SymbolicName=MSG_FILE_MEDIA_UNKNOWN +Language=English +A size is not specified for a new image file. +. + + +MessageId= +SymbolicName=MSG_CREATE144_NOTICE +Language=English +Creating a 1.44MB image. +. + + +MessageId= +SymbolicName=MSG_CREATE144_CONFIRM +Language=English +Create a 1.44MB image (Y:yes / N:no) ? %0 +. + + +MessageId= +SymbolicName=MSG_IMAGE_TOO_SMALL +Language=English +The image is too small. +. + + +MessageId= +SymbolicName=MSG_NO_MATCHING_MEDIA +Language=English +The image size (%1!lu! bytes) does not match any supported media. +. + + +MessageId= +SymbolicName=MSG_MEDIATYPE_NOTICE +Language=English +Opening as a %1!s! media (%2!lu! bytes). +. + + +MessageId= +SymbolicName=MSG_MEDIATYPE_SUGGEST +Language=English +The largest possible media is %1!s! (%2!lu! bytes). +. + + +MessageId= +SymbolicName=MSG_MEDIATYPE_CONFIRM +Language=English +Open as this media type (Y:yes / N:no) ? %0 +. + + +MessageId= +SymbolicName=MSG_RAM_MODE_NOTICE +Language=English +Opening the image in RAM mode. +. + + +MessageId= +SymbolicName=MSG_RAM_MODE_ONLY +Language=English +This file must be opened in RAM mode. +. + + +MessageId= +SymbolicName=MSG_RAM_MODE_CONFIRM +Language=English +Open in RAM mode (Y:yes / N:no) ? %0 +. + + +MessageId= +SymbolicName=MSG_DEFAULT_PROTECT +Language=English +The media will be write protected by default. +. + + +MessageId= +SymbolicName=MSG_DRIVE_BUSY +Language=English +An image is already opened. +. + + +MessageId= +SymbolicName=MSG_TARGET_REQUIRED +Language=English +Specify a target file to save. +. + + +MessageId= +SymbolicName=MSG_TARGET_UP_TO_DATE +Language=English +The image file is up to date. +. + + +MessageId= +SymbolicName=MSG_OVERWRITE_PROMPT +Language=English +Overwrite the existing file +(O: just overwrite / T: overwrite & truncate / C: cancel) ? %0 +. + + +MessageId= +SymbolicName=MSG_TARGET_IS_ZIP +Language=English +Cannot overwrite a ZIP compressed file. +. + + +MessageId= +SymbolicName=MSG_SAVE_FORCE +Language=English +The save operation is forced to continue. +. + + +MessageId= +SymbolicName=MSG_SAVE_QUIT +Language=English +The save operation is aborted. +. + + +MessageId= +SymbolicName=MSG_FORMAT_FORCE +Language=English +The format operation is forced to continue. +. + + +MessageId= +SymbolicName=MSG_FORMAT_QUIT +Language=English +The format operation is aborted. +. + + +MessageId= +SymbolicName=MSG_MEDIA_MODIFIED +Language=English +RAM disk data on the drive %1!c!: is modified. +. + + +MessageId= +SymbolicName=MSG_CLOSE_FORCE +Language=English +The close operation is forced to continue. +. + + +MessageId= +SymbolicName=MSG_CLOSE_QUIT +Language=English +The close operation is aborted. +. + + +MessageId= +SymbolicName=MSG_CLOSE_CONFIRM +Language=English +Close the image anyway (Y:yes / N:no) ? %0 +. + + +MessageId= +SymbolicName=MSG_RETRY_FORCE_CANCEL +Language=English +R:retry / F:force / C:cancel ? %0 +. + + +MessageId= +SymbolicName=MSG_RETRY_CANCEL +Language=English +R:retry / C:cancel ? %0 +. + + +MessageId= +SymbolicName=MSG_LOCK_NG +Language=English +Failed to lock the drive %1!c!. Some programs may be using the drive. +. + + +MessageId= +SymbolicName=MSG_STOP_FORCE +Language=English +Failed to close the all drives. The operation is forced to continue. +. + + +MessageId= +SymbolicName=MSG_STOP_QUIT +Language=English +Failed to close the all drives. The operation is aborted. +. + + +MessageId= +SymbolicName=MSG_STOP_WARN +Language=English +Failed to close the all drives. The driver may not be able to unload +properly. Continue the stop operation? +. + + +MessageId= +SymbolicName=MSG_REMOVE_FORCE +Language=English +Failed to stop the driver. The operation is forced to continue; +. + + +MessageId= +SymbolicName=MSG_REMOVE_QUIT +Language=English +Failed to stop the driver. The operation is aborted. +. + + +MessageId= +SymbolicName=MSG_REMOVE_WARN +Language=English +Failed to stop the driver. The driver may not be removed completely +until the system is restarted. Continue the operation? +. + + +MessageId= +SymbolicName=MSG_UNKNOWN_LONG +Language=English +Unknown (0x%1!08x!) +. + + +MessageId= +SymbolicName=MSG_DRIVER_FILE +Language=English +Driver : %1!s! +. + + +MessageId= +SymbolicName=MSG_DRIVER_VERSION +Language=English +Version : %1!d!.%2!d! %3!s! +. + + +MessageId= +SymbolicName=MSG_START_TYPE +Language=English +Start Type : %0 +. + + +MessageId= +SymbolicName=MSG_START_AUTO +Language=English +AUTO +. + + +MessageId= +SymbolicName=MSG_START_BOOT +Language=English +BOOT +. + + +MessageId= +SymbolicName=MSG_START_DEMAND +Language=English +DEMAND +. + + +MessageId= +SymbolicName=MSG_START_DISABLED +Language=English +DISABLED +. + + +MessageId= +SymbolicName=MSG_START_SYSTEM +Language=English +SYSTEM +. + + +MessageId= +SymbolicName=MSG_DRIVER_STATUS +Language=English +Status : %0 +. + + +MessageId= +SymbolicName=MSG_STATUS_STOPPED +Language=English +STOPPED +. + + +MessageId= +SymbolicName=MSG_STATUS_START_P +Language=English +START_PENDING +. + + +MessageId= +SymbolicName=MSG_STATUS_STOP_P +Language=English +STOP_PENDING +. + + +MessageId= +SymbolicName=MSG_STATUS_RUNNING +Language=English +RUNNING +. + + +MessageId= +SymbolicName=MSG_STATUS_CONT_P +Language=English +CONTINUE_PENDING +. + + +MessageId= +SymbolicName=MSG_STATUS_PAUSE_P +Language=English +PAUSE_PENDING +. + + +MessageId= +SymbolicName=MSG_STATUS_PAUSED +Language=English +PAUSED +. + + +MessageId= +SymbolicName=MSG_DRIVE_LETTER +Language=English +Drive %1!lu! : %0 +. + + +MessageId= +SymbolicName=MSG_PERSISTENT +Language=English +%1!c! (Persistent) %0 +. + + +MessageId= +SymbolicName=MSG_EPHEMERAL +Language=English +%1!c! (Ephemeral) %0 +. + + +MessageId= +SymbolicName=MSG_IMAGE_NONE +Language=English +Image : <none> +. + + +MessageId= +SymbolicName=MSG_IMAGE_NAME +Language=English +Image : %1!s! +. + + +MessageId= +SymbolicName=MSG_FILE_DESC +Language=English +Description: %1!s! +. + + +MessageId= +SymbolicName=MSG_DISKTYPE_FILE +Language=English +Type : FILE +. + + +MessageId= +SymbolicName=MSG_DISKTYPE_RAM_CLEAN +Language=English +Type : RAM (not modified) +. + + +MessageId= +SymbolicName=MSG_DISKTYPE_RAM_DIRTY +Language=English +Type : RAM (modified) +. + + +MessageId= +SymbolicName=MSG_MEDIA_TYPE +Language=English +Media : %1!s! +. + + +MessageId= +SymbolicName=MSG_MEDIA_WRITABLE +Language=English +Access : Writable +. + + +MessageId= +SymbolicName=MSG_MEDIA_PROTECTED +Language=English +Access : Write Protected +. + + +;// +;// Help message text +;// +MessageId= +SymbolicName=MSG_HINT_INSTALL +Language=English +SYNTAX: %1!s!INSTALL [driver] [/AUTO | /A] +Try '%1!s!HELP INSTALL' for more information. +. + + +MessageId= +SymbolicName=MSG_HINT_REMOVE +Language=English +SYNTAX: %1!s!REMOVE [/FORCE | /F | /QUIT | /Q] +Try '%1!s!HELP REMOVE' for more information. +. + + +MessageId= +SymbolicName=MSG_HINT_CONFIG +Language=English +SYNTAX: %1!s!CONFIG {/AUTO | /A | /MANUAL | /M} +Try '%1!s!HELP CONFIG' for more information. +. + + +MessageId= +SymbolicName=MSG_HINT_START +Language=English +SYNTAX: %1!s!START +Try '%1!s!HELP START' for more information. +. + + +MessageId= +SymbolicName=MSG_HINT_STOP +Language=English +SYNTAX: %1!s!STOP [/FORCE | /F | /QUIT | /Q] +Try '%1!s!HELP STOP' for more information. +. + + +MessageId= +SymbolicName=MSG_HINT_SHELL +Language=English +SYNTAX: %1!s!SHELL [/ON | /OFF] +Try '%1!s!HELP SHELL' for more information. +. + + +MessageId= +SymbolicName=MSG_HINT_OPEN +Language=English +SYNTAX: %1!s!OPEN [drive:] [file] [/NEW] [/RAM] [/P | /W] + [ /160 | /180 | /320 | /360 | /640 | /720 | /820 | /120 | /1.20 + | /144 | /1.44 | /168 | /1.68 | /172 | /1.72 | /288 | /2.88 ] + [ /5 | /525 | /5.25 ] [/F | /FORCE | /Q | QUIT] +Try '%1!s!HELP OPEN' for more information. +. + + +MessageId= +SymbolicName=MSG_HINT_CLOSE +Language=English +SYNTAX: %1!s!CLOSE [drive:] [/FORCE | /F | /QUIT | /Q] +Try '%1!s!HELP CLOSE' for more information. +. + + +MessageId= +SymbolicName=MSG_HINT_SAVE +Language=English +SYNTAX: %1!s!SAVE [drive:] [file] [/OVER | /O | /TRUNC | /T] + [/FORCE | /F | /QUIT | /Q] +Try '%1!s!HELP SAVE' for more information. +. + + +MessageId= +SymbolicName=MSG_HINT_PROTECT +Language=English +SYNTAX: %1!s!PROTECT [drive:] [/ON | /OFF] +Try '%1!s!HELP PROTECT' for more information. +. + + +MessageId= +SymbolicName=MSG_HINT_FORMAT +Language=English +SYNTAX: %1!s!FORMAT [drive:] [/FORCE | /F | /QUIT | /Q] +Try '%1!s!HELP FORMAT' for more information. +. + + +MessageId= +SymbolicName=MSG_HINT_LINK +Language=English +SYNTAX: %1!s!LINK [number] [letter] [/L] +Try '%1!s!HELP LINK' for more information. +. + + +MessageId= +SymbolicName=MSG_HINT_ULINK +Language=English +SYNTAX: %1!s!ULINK [drive] +Try '%1!s!HELP ULINK' for more information. +. + + +MessageId= +SymbolicName=MSG_HINT_STATUS +Language=English +SYNTAX: %1!s!STATUS +Try '%1!s!HELP STATUS' for more information. +. + + +MessageId= +SymbolicName=MSG_HINT_VERSION +Language=English +SYNTAX: %1!s!VERSION +Print version information. +. + + +MessageId= +SymbolicName=MSG_HELP_GENERAL +Language=English +Usage: + %1!s![command [options...]] + +Commands: + INSTALL Install the Virtual Floppy driver. + REMOVE Uninstall the Virtual Floppy driver. + CONFIG Configure the Virtual Floppy driver. + START Start the Virtual Floppy driver. + STOP Stop the Virtual Floppy driver. + SHELL Enable/disable the shell extension. + OPEN Open a Virtual Floppy image. + CLOSE Close a Virtual Floppy image. + SAVE Save the current image into a file. + PROTECT Enable/disable drive write protect. + FORMAT Format the current Virtual Floppy media. + LINK Assign a drive letter to a Virtual Floppy drive. + ULINK Remove a drive letter from a Virtual Floppy drive. + STATUS Print the current status. + HELP | ? Print usage help. + VERSION Print version information + +If a command is not specified, the interactive console is started. +Type '%1!s!HELP CONSOLE' for more information about the interactive +console. + +All commands and options are case insensitive. + +Shorter command name can be used as long as the command can be +distinguished uniquely: I for INSTALL, REM for REMOVE, etc. are +accepted, but ST is invalid because it is ambiguous. You have +to type as much as STAR, STO or STAT in order to distinguish them. + +'%1!s!command {/? | /h}' shows a brief hint about each command. +. + + +MessageId= +SymbolicName=MSG_HELP_INSTALL +Language=English +Install the Virtual Floppy driver. + +SYNTAX: + %1!s!INSTALL [driver] [/AUTO | /A] + +OPTIONS: + driver Specifies the path to the Virtual Floppy driver file. + Default is VFD.SYS in the same directory as the VFD + console program (Note: *NOT* current directory). + + /AUTO Configures the driver to start at the system startup. + /A (Note: *NOT* to start the driver after installation.) + By default the driver has to be started manually. + +Administrator rights are required to install a devide driver. + +Device drivers cannot be installed from network drives. +Make sure to place VFD.SYS on a local drive. + +It is advised to install the driver with the /AUTO option if the +Virtual Floppy drive is going to be used by users other than +Administrators and Power Users, who don't have enough rights to +start device drivers. +. + + +MessageId= +SymbolicName=MSG_HELP_CONFIG +Language=English +Configure the Virtual Floppy driver start method. + +SYNTAX: + %1!s!CONFIG {/AUTO | /A | /MANUAL | /M} + +OPTIONS: + /AUTO Configures the driver to start at the system startup. + /A + + /MANUAL Configures the driver to start on demand. + /M + +The change takes effect the next system start up. +Administrator rights are required to configure a devide driver. +. + + +MessageId= +SymbolicName=MSG_HELP_REMOVE +Language=English +Uninstall the Virtual Floppy driver. + +SYNTAX: + %1!s!REMOVE [/FORCE | /F | /QUIT | /Q] + +OPTIONS: + /FORCE Suppress prompting and forces the remove operation when + /F the driver cannot be stopped. + + /QUIT Suppress prompting and quits the remove operation when + /Q the driver cannot be stopped. + +Closes all images and stops the driver if necessary, then removes the +Virtual Floppy driver entries from the system registry. +This command does not delete the driver file from the local disk. + +There are cases, due to the condition of the system, when +uninstallation does not complete immediately and restarting of the +system is required. In such cases you may not be able to install the +Virtual Floppy driver again until the system is restarted and +uninstallation process is complete. + +Administrator rights are required to uninstall a device driver. +. + + +MessageId= +SymbolicName=MSG_HELP_START +Language=English +Start the Virtual Floppy driver. + +SYNTAX: + %1!s!START + +OPTIONS: + NONE + +If the driver is not installed, this command attempts to install it +with thedefault options. + +At least Power User rights are required to start a device driver. +. + + +MessageId= +SymbolicName=MSG_HELP_STOP +Language=English +Stop the Virtual Floppy driver + +SYNTAX: + %1!s!STOP [/FORCE | /F | /QUIT | /Q] + +OPTIONS: + /FORCE Suppress prompting and forces the stop operation when any + /F of the drives are in use and cannot be closed. + + /QUIT Suppress prompting and quits the stop operation when any + /Q of the drives are in use and cannot be closed. + +This command closes all images before stopping the driver. +An image cannot be closed if the virtual drive is used by any other +programs. Forcing the stop operation with a drive in use may leave +the driver in stop pending state. In such cases the driver cannot be +restarted until all programs stop using the drive and the driver is +properly unloaded. + +At least Power User rights are required to stop a device driver. +. + + +MessageId= +SymbolicName=MSG_HELP_SHELL +Language=English +Enable / disable the Virtual Floppy drive shell extension. + +SYNTAX: + %1!s!SHELL [/ON | /OFF] + +OPTIONS: + /ON Enables the shell extension. + + /OFF Disables the shell extension. + +If an option is not specified, this command prints the current state +of the shell extension. +. + + +MessageId= +SymbolicName=MSG_HELP_OPEN +Language=English +Open a Virtual Floppy image. + +SYNTAX: + %1!s!OPEN [drive:] [file] [/NEW] [/RAM] [/P | /W] + [/size] [/media] [/F | /FORCE | /Q | /QUIT] + +OPTIONS: + drive: Specifies a target Virtual Floppy drive, either by a drive + number or a drive letter, such as "0:", "1:", "B:", "X:". + The trailing ':' is required. + The drive 0 is assumed if not specified. + + file Specifies a Virtual Floppy image file to open. + An empty RAM disk is created if not specified. + + /NEW Creates a new image file. + Ignored if a file is not specified. + + /RAM RAM mode - mounts an on-memory copy of the image, instead + of directly mounting the image file. + Changes made to the virtual media are lost when the image + is closed, unless the image is explicitly saved to a file + with the 'SAVE' command. + Ignored if a file is not specified. + + /P Opens the image as a write protected media. + Write protection state can be chenged later with the + 'PROTECT' command. + + /W Opens the image as a writable media. + Write protection state can be chenged later with the + 'PROTECT' command. + + /size Specifies a media size. Acceptable options are: + + /160 (160KB) /820 (820KB) + /180 (180KB) /120 or /1.20 (1.20MB) + /320 (320KB) /144 or /1.44 (1.44MB) + /360 (360KB) /168 or /1.68 (1.68MB DMF) + /640 (640KB) /172 or /1.72 (1.72MB DMF) + /720 (720KB) /288 or /2.88 (2.88MB) + + /5 Specifies a 5.25 inch media. Takes effect only with + /525 640KB, 720KB and 1.2MB media and otherwise ignored. + /5.25 160KB, 180KB, 320KB and 360KB media are always 5.25". + 820KB, 1.44MB, 1.68MB, 1.72MB and 2.88MB media are always + 3.5". + + /FORCE Suppress prompring on minor conflicts and/or omission of + /F necessary parameters and continues the operation as best + as possible, employing default values if necessary. + See below for details. + + /QUIT Suppress prompring on minor conflicts and/or omission of + /Q necessary parameters and quits the operation on the first + such occasion. + See below for details. + +If the target drive does not have a drive letter, this command also +assigns a local drive letter (see '%1!s!HELP LINK') using the first +available letter. + +Read only files, NTFS encrypted/compressed files and ZIP compressed +image files (such as WinImage IMZ file) cannot be mounted directly +and must be opened in RAM mode. + +Without a size option, size of a virtual media is decided from the +actual image size. With an explicit size option you can mount a +file as a smaller media, in such cases surplus data at the end of +the image is ignored. +A virtual media size cannot exceed the actual image size. + +The /F and /Q options affect the behavior of the OPEN command in +many ways: + + When the target file does not exist and the /NEW option + is not present + + (none) ask user whether to create the target + /F create the target without asking + /Q abort the operation without asking + + The target file exists and the /NEW option is present + + (none) ask user whether to overwrite the existing file + /F overwrite the file without asking + /Q abort the operation without asking + + The target file cannot be mounted directly and the /RAM + option is not present + + (none) ask user whether to open in RAM mode + /F open in RAM mode without asking + /Q abort the operation without asking + + A size option is not present for creating a new image + + (none) ask user whether to create a 1.44MB (default) image + /F create a 1.44MB image without asking + /Q abort the operation without asking + + A size option is not present and the target file size is + not an exact match for any of supported media + + (none) ask user whether to mount as a largest media to fit + in the actual image + /F mount as a largest media to fit in the actual image + without asking + /Q abort the operation without asking +. + + +MessageId= +SymbolicName=MSG_HELP_CLOSE +Language=English +Close a Virtual Floppy image. + +SYNTAX: + %1!s!CLOSE [drive:] [/FORCE | /F | /QUIT | /Q] + +OPTIONS: + drive: Specifies a target Virtual Floppy drive, either by a drive + number or a drive letter, such as "0:", "1:", "B:", "X:". + The trailing ':' is optional. + "*" stands for both drives. + The drive 0 is used if not specified. + + /FORCE Suppress prompting and forces the close operation when RAM + /F disk data is modified or the drive is in use. + Forcing with the drive in use will work only on Windows + 2000 and later (not on NT). + + /QUIT Suppress prompting and quits the close operation when RAM + /Q disk data is modified or the drive is in use. + +If neither /Q nor /F is specified, the user has to choose whether to +retry, force, or quit. + +Unlike the previous versions of the VFD, this command does *NOT* +remove the drive letter of the target drive. +. + + +MessageId= +SymbolicName=MSG_HELP_SAVE +Language=English ... 17405 lines suppressed ...
7 years
1
0
0
0
[reactos] 01/02: [PSDK] Add some missing defines
by Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d82796778f91d61eaa9ca…
commit d82796778f91d61eaa9ca0e1086d263227b7fbe4 Author: Pierre Schweitzer <pierre(a)reactos.org> AuthorDate: Sat Dec 16 21:43:49 2017 +0100 [PSDK] Add some missing defines CORE-14090 --- sdk/include/psdk/ntdddisk.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sdk/include/psdk/ntdddisk.h b/sdk/include/psdk/ntdddisk.h index 064ebbfd76..9deb6abc79 100644 --- a/sdk/include/psdk/ntdddisk.h +++ b/sdk/include/psdk/ntdddisk.h @@ -109,6 +109,9 @@ extern "C" { #define IOCTL_DISK_INTERNAL_SET_VERIFY \ CTL_CODE(IOCTL_DISK_BASE, 0x0100, METHOD_NEITHER, FILE_ANY_ACCESS) +#define IOCTL_DISK_INTERNAL_SET_NOTIFY \ + CTL_CODE(IOCTL_DISK_BASE, 0x0102, METHOD_BUFFERED, FILE_ANY_ACCESS) + #define IOCTL_DISK_IS_WRITABLE \ CTL_CODE(IOCTL_DISK_BASE, 0x0009, METHOD_BUFFERED, FILE_ANY_ACCESS) @@ -185,6 +188,9 @@ extern "C" { #define IOCTL_DISK_COPY_DATA \ CTL_CODE(IOCTL_DISK_BASE, 0x0019, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) +#define IOCTL_DISK_SIMBAD \ + CTL_CODE(IOCTL_DISK_BASE, 0x0400, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) + #define SMART_GET_VERSION \ CTL_CODE(IOCTL_DISK_BASE, 0x0020, METHOD_BUFFERED, FILE_READ_ACCESS)
7 years
1
0
0
0
[reactos] 01/01: [DOSKEY] Resource files: remove trailing whitespace.
by Hermès Bélusca-Maïto
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=0710eae7806f45d8f295f…
commit 0710eae7806f45d8f295f67e4d88a4367a0c5aaf Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org> AuthorDate: Sat Dec 16 21:09:59 2017 +0100 [DOSKEY] Resource files: remove trailing whitespace. --- base/applications/cmdutils/doskey/lang/it-IT.rc | 2 +- base/applications/cmdutils/doskey/lang/ro-RO.rc | 2 +- base/applications/cmdutils/doskey/lang/sq-AL.rc | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/base/applications/cmdutils/doskey/lang/it-IT.rc b/base/applications/cmdutils/doskey/lang/it-IT.rc index 1b22aa51ff..ff0496b0d2 100644 --- a/base/applications/cmdutils/doskey/lang/it-IT.rc +++ b/base/applications/cmdutils/doskey/lang/it-IT.rc @@ -1,4 +1,4 @@ -LANGUAGE LANG_ITALIAN, SUBLANG_DEFAULT +LANGUAGE LANG_ITALIAN, SUBLANG_DEFAULT STRINGTABLE BEGIN diff --git a/base/applications/cmdutils/doskey/lang/ro-RO.rc b/base/applications/cmdutils/doskey/lang/ro-RO.rc index 0f94a1c666..1cf35f9b5a 100644 --- a/base/applications/cmdutils/doskey/lang/ro-RO.rc +++ b/base/applications/cmdutils/doskey/lang/ro-RO.rc @@ -1,4 +1,4 @@ -/* +/* * FILE: base/applications/cmdutils/doskey/lang/ro-RO.rc * ReactOS Project (
http://www.reactos.org
) * TRANSLATOR: Fulea Ștefan (PM on ReactOS Forum at fulea.stefan) diff --git a/base/applications/cmdutils/doskey/lang/sq-AL.rc b/base/applications/cmdutils/doskey/lang/sq-AL.rc index 583aaad387..74e16bd0f2 100644 --- a/base/applications/cmdutils/doskey/lang/sq-AL.rc +++ b/base/applications/cmdutils/doskey/lang/sq-AL.rc @@ -1,4 +1,4 @@ -/* TRANSLATOR : Ardit Dani (Ard1t) (ardit.dani(a)gmail.com) +/* TRANSLATOR : Ardit Dani (Ard1t) (ardit.dani(a)gmail.com) * DATE OF TR: 29-11-2013 */
7 years
1
0
0
0
[reactos] 02/02: [DOSKEY] Improvements when importing aliases definition files.
by Hermès Bélusca-Maïto
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=ae9702fcec5e041f4f52b…
commit ae9702fcec5e041f4f52bc0b83b506f4e1cee13b Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org> AuthorDate: Sat Dec 16 21:01:08 2017 +0100 [DOSKEY] Improvements when importing aliases definition files. - The aliases ("macros") definition files have the same format as what is output by DosKey when one displays the list of defined aliases with the /macros: command-line switch. It should then, in particular, understand the format where executable names are also specified: [exename1] alias1=command1 ... [exename2] aliasN=commandN ... We now behave similarly as Windows' version of this utility in that regard. - Use ARRAYSIZE() when needed. - Take the opportunity to add a license header to the source file. --- base/applications/cmdutils/doskey/doskey.c | 113 +++++++++++++++++++++------- base/applications/cmdutils/doskey/doskey.rc | 4 +- 2 files changed, 89 insertions(+), 28 deletions(-) diff --git a/base/applications/cmdutils/doskey/doskey.c b/base/applications/cmdutils/doskey/doskey.c index 0c2694f716..47991c957d 100644 --- a/base/applications/cmdutils/doskey/doskey.c +++ b/base/applications/cmdutils/doskey/doskey.c @@ -1,3 +1,12 @@ +/* + * PROJECT: ReactOS DosKey Command + * LICENSE: GPL-2.0+ (
https://spdx.org/licenses/GPL-2.0+
) + * PURPOSE: Provides history and command aliases management for + * command-line programs. + * COPYRIGHT: Copyright 2008 Christoph von Wittich + * Copyright 2013-2017 Hermès Bélusca-Maïto + */ + #include <stdio.h> #include <wchar.h> #include <locale.h> @@ -8,6 +17,8 @@ #include <wincon.h> /* Console API functions which are absent from wincon.h */ +#define EXENAME_LENGTH (255 + 1) + VOID WINAPI ExpungeConsoleCommandHistoryW(LPCWSTR lpExeName); @@ -37,7 +48,7 @@ static VOID SetInsert(DWORD dwFlag) { /* * NOTE: Enabling the ENABLE_INSERT_MODE mode can also be done by calling - * kernel32:SetConsoleCommandHistoryMode(CONSOLE_OVERSTRIKE) . + * kernel32:SetConsoleCommandHistoryMode(CONSOLE_OVERSTRIKE) (deprecated). */ DWORD dwMode; HANDLE hConsole = GetStdHandle(STD_INPUT_HANDLE); @@ -98,7 +109,10 @@ static INT SetMacro(LPWSTR definition) *nameend = temp; } - LoadStringW(GetModuleHandle(NULL), IDS_INVALID_MACRO_DEF, szStringBuf, MAX_STRING); + LoadStringW(GetModuleHandle(NULL), + IDS_INVALID_MACRO_DEF, + szStringBuf, + ARRAYSIZE(szStringBuf)); wprintf(szStringBuf, definition); return 1; } @@ -155,29 +169,86 @@ static VOID PrintAllMacros(VOID) HeapFree(GetProcessHeap(), 0, ExeNameBuf); } -static VOID ReadFromFile(LPWSTR param) +/* Remove starting and ending quotes from a string, if present */ +static LPWSTR RemoveQuotes(LPWSTR str) +{ + WCHAR *end; + if (*str == L'"' && *(end = str + wcslen(str) - 1) == L'"') + { + str++; + *end = L'\0'; + } + return str; +} + +static VOID ReadFromFile(LPWSTR FileName) { FILE* fp; WCHAR line[MAX_PATH]; + WCHAR ExeNameBuffer[EXENAME_LENGTH]; + LPWSTR pszOrgExeName = pszExeName; - fp = _wfopen(param, L"r"); + /* Open the file */ + fp = _wfopen(FileName, L"rt"); if (!fp) { - _wperror(param); + _wperror(FileName); return; } - while ( fgetws(line, MAX_PATH, fp) != NULL) + while (fgetws(line, ARRAYSIZE(line), fp) != NULL) { - /* Remove newline character */ - WCHAR *end = &line[wcslen(line) - 1]; + PWCHAR end; + + if (!*line) + continue; + + /* Remove trailing newline character */ + end = &line[wcslen(line) - 1]; if (*end == L'\n') *end = L'\0'; - if (*line) + if (!*line) + continue; + + /* Check for any section redefining the current executable name */ + end = NULL; + if (*line == L'[') + end = wcschr(line, L']'); + + if (end != NULL) + { + /* New section: change the current executable name */ + + *end = L'\0'; // NULL-terminate it + pszExeName = RemoveQuotes(line + 1); + if (*pszExeName) + { + /* Capture the new executable name and truncate it if needed */ + end = &pszExeName[wcslen(pszExeName)]; + if (end - pszExeName >= EXENAME_LENGTH) + end = &pszExeName[EXENAME_LENGTH - 1]; + *end = L'\0'; // Truncate it + wcscpy(ExeNameBuffer, pszExeName); + pszExeName = ExeNameBuffer; + } + else + { + /* Restore the original current executable name */ + pszExeName = pszOrgExeName; + } + } + else + { + /* Set the new macro for the current executable */ SetMacro(line); + } } + /* Restore the original current executable name if it has changed */ + pszExeName = pszOrgExeName; + + /* Close the file and return */ fclose(fp); return; } @@ -201,23 +272,10 @@ static BOOL GetArg(WCHAR **pStart, WCHAR **pEnd) return TRUE; } -/* Remove starting and ending quotes from a string, if present */ -static LPWSTR RemoveQuotes(LPWSTR str) -{ - WCHAR *end; - if (*str == L'"' && *(end = str + wcslen(str) - 1) == L'"') - { - str++; - *end = L'\0'; - } - return str; -} - int wmain(VOID) { - WCHAR *pArgStart; - WCHAR *pArgEnd; + LPWSTR pArgStart, pArgEnd; setlocale(LC_ALL, ""); @@ -230,13 +288,16 @@ wmain(VOID) while (GetArg(&pArgStart, &pArgEnd)) { - /* NUL-terminate this argument to make processing easier */ + /* NULL-terminate this argument to make processing easier */ WCHAR tmp = *pArgEnd; *pArgEnd = L'\0'; if (!wcscmp(pArgStart, L"/?")) { - LoadStringW(GetModuleHandle(NULL), IDS_HELP, szStringBuf, MAX_STRING); + LoadStringW(GetModuleHandle(NULL), + IDS_HELP, + szStringBuf, + ARRAYSIZE(szStringBuf)); wprintf(szStringBuf); break; } @@ -287,7 +348,7 @@ wmain(VOID) { /* This is the beginning of a macro definition. It includes * the entire remainder of the line, so first put back the - * character that we replaced with NUL. */ + * character that we replaced with NULL. */ *pArgEnd = tmp; return SetMacro(pArgStart); } diff --git a/base/applications/cmdutils/doskey/doskey.rc b/base/applications/cmdutils/doskey/doskey.rc index 64d6a041b6..d17a967856 100644 --- a/base/applications/cmdutils/doskey/doskey.rc +++ b/base/applications/cmdutils/doskey/doskey.rc @@ -2,7 +2,7 @@ #include "doskey.h" -#define REACTOS_STR_FILE_DESCRIPTION "ReactOS Doskey Command" +#define REACTOS_STR_FILE_DESCRIPTION "ReactOS DosKey Command" #define REACTOS_STR_INTERNAL_NAME "doskey" #define REACTOS_STR_ORIGINAL_FILENAME "doskey.exe" #include <reactos/version.rc> @@ -54,4 +54,4 @@ #endif #ifdef LANGUAGE_ZH_TW #include "lang/zh-TW.rc" -#endif \ No newline at end of file +#endif
7 years
1
0
0
0
[reactos] 01/02: [KERNEL32] Improve the definition of EXENAME_LENGTH.
by Hermès Bélusca-Maïto
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=eea43394bf2a239e5507e…
commit eea43394bf2a239e5507eb15fb5201d261665f77 Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org> AuthorDate: Sat Dec 16 20:58:08 2017 +0100 [KERNEL32] Improve the definition of EXENAME_LENGTH. --- dll/win32/kernel32/client/console/console.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dll/win32/kernel32/client/console/console.c b/dll/win32/kernel32/client/console/console.c index 6547c0c2c3..1e79b34e76 100644 --- a/dll/win32/kernel32/client/console/console.c +++ b/dll/win32/kernel32/client/console/console.c @@ -37,7 +37,7 @@ extern BOOL WINAPI IsDebuggerPresent(VOID); /* Console Input facilities */ HANDLE InputWaitHandle = INVALID_HANDLE_VALUE; -#define EXENAME_LENGTH 255 + 1 +#define EXENAME_LENGTH (255 + 1) static RTL_CRITICAL_SECTION ExeNameLock; static BOOLEAN ExeNameInitialized; static WCHAR ExeNameBuffer[EXENAME_LENGTH]; // NULL-terminated
7 years
1
0
0
0
← Newer
1
...
15
16
17
18
19
20
21
...
36
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
Results per page:
10
25
50
100
200