ReactOS 0.4.16-dev-2104-gb84fa49
automount.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS DiskPart
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: base/system/diskpart/automount.c
5 * PURPOSE: Manages all the partitions of the OS in an interactive way.
6 * PROGRAMMERS: Lee Schroeder
7 */
8
9#include "diskpart.h"
10
11#define NDEBUG
12#include <debug.h>
13
14
19{
20 BOOL bDisable = FALSE, bEnable = FALSE, bScrub = FALSE;
21#if 0
22 BOOL bNoErr = FALSE;
23#endif
24 INT i;
26
27 DPRINT("Automount()\n");
28
29 for (i = 1; i < argc; i++)
30 {
31 if (_wcsicmp(argv[i], L"noerr") == 0)
32 {
33 /* noerr */
34#if 0
35 bNoErr = TRUE;
36#endif
37 }
38 }
39
40 for (i = 1; i < argc; i++)
41 {
42 if (_wcsicmp(argv[i], L"disable") == 0)
43 {
44 /* set automount state */
45 bDisable = TRUE;
46 }
47 else if (_wcsicmp(argv[i], L"enable") == 0)
48 {
49 /* set automount state */
50 bEnable = TRUE;
51 }
52 else if (_wcsicmp(argv[i], L"scrub") == 0)
53 {
54 /* scrub automount */
55 bScrub = TRUE;
56 }
57 else if (_wcsicmp(argv[i], L"noerr") == 0)
58 {
59 /* noerr - Already handled above */
60 }
61 else
62 {
64 return TRUE;
65 }
66 }
67
68 DPRINT("bDisable %u\n", bDisable);
69 DPRINT("bEnable %u\n", bEnable);
70 DPRINT("bScrub %u\n", bScrub);
71
72 if (bDisable && bEnable)
73 {
75 return TRUE;
76 }
77
78 if ((bDisable == FALSE) && (bEnable == FALSE) && (bScrub == FALSE))
79 {
80 DPRINT("Show automount\n");
82 if (Result == FALSE)
83 {
84// ConResPuts(StdErr, IDS_ERROR_INVALID_ARGS);
85 return TRUE;
86 }
87
88 if (State)
90 else
92 ConPuts(StdOut, L"\n");
93 }
94
95 if (bDisable)
96 {
97 DPRINT("Disable automount\n");
99 if (Result == FALSE)
100 {
101// ConResPuts(StdErr, IDS_ERROR_INVALID_ARGS);
102 return TRUE;
103 }
104
106 ConPuts(StdOut, L"\n");
107 }
108
109 if (bEnable)
110 {
111 DPRINT("Enable automount\n");
113 if (Result == FALSE)
114 {
115// ConResPuts(StdErr, IDS_ERROR_INVALID_ARGS);
116 return TRUE;
117 }
118
120 ConPuts(StdOut, L"\n");
121 }
122
123 if (bScrub)
124 {
125 DPRINT("Scrub automount\n");
127 if (Result == FALSE)
128 {
129// ConResPuts(StdErr, IDS_ERROR_INVALID_ARGS);
130 return TRUE;
131 }
132
134 ConPuts(StdOut, L"\n");
135 }
136
137 return EXIT_SUCCESS;
138}
static int argc
Definition: ServiceArgs.c:12
EXIT_CODE automount_main(_In_ INT argc, _In_ PWSTR *argv)
Definition: automount.c:16
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 IDS_AUTOMOUNT_SCRUBBED
Definition: resource.h:28
#define IDS_ERROR_INVALID_ARGS
Definition: resource.h:229
#define IDS_AUTOMOUNT_DISABLED
Definition: resource.h:27
#define IDS_AUTOMOUNT_ENABLED
Definition: resource.h:26
enum _EXIT_CODE EXIT_CODE
BOOL GetAutomountState(_Out_ PBOOL State)
Definition: mountmgr.c:46
BOOL ScrubAutomount(VOID)
Definition: mountmgr.c:141
BOOL SetAutomountState(_In_ BOOL bEnable)
Definition: mountmgr.c:90
#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
#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 _In_
Definition: no_sal2.h:158
#define EXIT_SUCCESS
Definition: rdjpgcom.c:55
#define DPRINT
Definition: sndvol32.h:73
uint16_t * PWSTR
Definition: typedefs.h:56
int32_t INT
Definition: typedefs.h:58
_In_ BOOL bEnable
Definition: winddi.h:3426
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:409