ReactOS 0.4.16-dev-2104-gb84fa49
remove.c File Reference
#include "diskpart.h"
#include <debug.h>
Include dependency graph for remove.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

EXIT_CODE remove_main (_In_ INT argc, _In_ PWSTR *argv)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 11 of file remove.c.

Function Documentation

◆ remove_main()

EXIT_CODE remove_main ( _In_ INT  argc,
_In_ PWSTR argv 
)

Definition at line 15 of file remove.c.

18{
19 PWSTR pszSuffix = NULL;
20 WCHAR DriveLetter = UNICODE_NULL;
21 INT i, nExclusive = 0;
22 BOOL bResult;
23
24 DPRINT("remove_main()\n");
25
26 if (CurrentVolume == NULL)
27 {
29 return EXIT_SUCCESS;
30 }
31
33 {
35 return EXIT_SUCCESS;
36 }
37
38 for (i = 1; i < argc; i++)
39 {
40 if (_wcsicmp(argv[i], L"noerr") == 0)
41 {
42 /* noerr */
43 ConPuts(StdOut, L"The NOERR option is not supported yet!\n");
44#if 0
45 bNoErr = TRUE;
46#endif
47 }
48 }
49
50 for (i = 1; i < argc; i++)
51 {
52 if (HasPrefix(argv[i], L"letter=", &pszSuffix))
53 {
54 if (wcslen(pszSuffix) == 1)
55 {
56 DriveLetter = towupper(*pszSuffix);
57 nExclusive++;
58 }
59 else
60 {
62 return EXIT_SUCCESS;
63 }
64 }
65 else if (HasPrefix(argv[i], L"mount=", &pszSuffix))
66 {
67 DPRINT("Mount\n", pszSuffix);
68 ConPuts(StdOut, L"The MOUNT option is not supported yet!\n");
69 nExclusive++;
70 }
71 else if (_wcsicmp(argv[i], L"all") == 0)
72 {
73 ConPuts(StdOut, L"The ALL option is not supported yet!\n");
74 nExclusive++;
75 }
76 else if (_wcsicmp(argv[i], L"dismount") == 0)
77 {
78 ConPuts(StdOut, L"The DISMOUNT option is not supported yet!\n");
79 }
80 else if (_wcsicmp(argv[i], L"noerr") == 0)
81 {
82 /* noerr - Already handled above */
83 }
84 else
85 {
87 return EXIT_SUCCESS;
88 }
89 }
90
91 if (nExclusive > 1)
92 {
94 return EXIT_SUCCESS;
95 }
96
97 DPRINT("VolumeName: %S\n", CurrentVolume->VolumeName);
98 DPRINT("DeviceName: %S\n", CurrentVolume->DeviceName);
99 DPRINT("DriveLetter: %C\n", CurrentVolume->DriveLetter);
100
101 if (DriveLetter != UNICODE_NULL)
102 {
103 DPRINT1("DriveLetter: %C\n", DriveLetter);
104
105 if ((DriveLetter < L'C') || (DriveLetter > L'Z'))
106 {
108 return EXIT_SUCCESS;
109 }
110
111 if (DriveLetter != CurrentVolume->DriveLetter)
112 {
114 return EXIT_SUCCESS;
115 }
116 }
117 else
118 {
119 DriveLetter = CurrentVolume->DriveLetter;
120 }
121
122 bResult = DeleteDriveLetter(DriveLetter);
123 if (bResult == FALSE)
124 {
126 return EXIT_SUCCESS;
127 }
128
131
132 return EXIT_SUCCESS;
133}
static int argc
Definition: ServiceArgs.c:12
void ConPuts(FILE *fp, LPCWSTR psz)
Definition: fc.c:16
#define StdOut
Definition: fc.c:14
#define StdErr
Definition: fc.c:15
void ConResPuts(FILE *fp, UINT nID)
Definition: fc.c:27
#define DPRINT1
Definition: precomp.h:8
#define IDS_REMOVE_NO_LETTER
Definition: resource.h:115
#define IDS_SELECT_NO_VOLUME
Definition: resource.h:130
#define IDS_REMOVE_FAIL
Definition: resource.h:113
#define IDS_ASSIGN_INVALID_LETTER
Definition: resource.h:33
#define IDS_ERROR_INVALID_ARGS
Definition: resource.h:229
#define IDS_REMOVE_SUCCESS
Definition: resource.h:114
#define IDS_REMOVE_WRONG_LETTER
Definition: resource.h:116
BOOL HasPrefix(_In_ PWSTR pszString, _In_ PWSTR pszPrefix, _Out_opt_ PWSTR *pszSuffix)
Definition: misc.c:58
BOOL DeleteDriveLetter(_In_ WCHAR DriveLetter)
Definition: mountmgr.c:338
PVOLENTRY CurrentVolume
Definition: partlist.c:77
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
_ACRTIMP int __cdecl _wcsicmp(const wchar_t *, const wchar_t *)
Definition: wcs.c:159
_ACRTIMP size_t __cdecl wcslen(const wchar_t *)
Definition: wcs.c:2983
#define L(x)
Definition: resources.c:13
unsigned int BOOL
Definition: ntddk_ex.h:94
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define argv
Definition: mplay32.c:18
#define UNICODE_NULL
#define EXIT_SUCCESS
Definition: rdjpgcom.c:55
#define towupper(c)
Definition: wctype.h:99
#define DPRINT
Definition: sndvol32.h:73
WCHAR VolumeName[MAX_PATH]
Definition: diskpart.h:237
WCHAR DeviceName[MAX_PATH]
Definition: diskpart.h:238
WCHAR DriveLetter
Definition: diskpart.h:241
uint16_t * PWSTR
Definition: typedefs.h:56
int32_t INT
Definition: typedefs.h:58
__wchar_t WCHAR
Definition: xmlstorage.h:180