ReactOS  0.4.15-dev-5122-g72bdbdd
setid.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/setid.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 
15 BOOL
17  _In_ INT argc,
18  _In_ PWSTR *argv)
19 {
20  UCHAR PartitionType = 0;
21  INT i, length;
22  PWSTR pszSuffix = NULL;
24 
25  DPRINT("SetId()\n");
26 
27  if (CurrentDisk == NULL)
28  {
30  return TRUE;
31  }
32 
33  if (CurrentPartition == NULL)
34  {
36  return TRUE;
37  }
38 
39  for (i = 1; i < argc; i++)
40  {
41  if (HasPrefix(argv[i], L"id=", &pszSuffix))
42  {
43  /* id=<Byte>|<GUID> */
44  DPRINT("Id : %s\n", pszSuffix);
45 
46  length = wcslen(pszSuffix);
47  if (length == 0)
48  {
50  return TRUE;
51  }
52 
53  if (length > 2)
54  {
56  return TRUE;
57  }
58 
59  /* Byte */
60  PartitionType = (UCHAR)wcstoul(pszSuffix, NULL, 16);
61  if (PartitionType == 0)
62  {
64  return TRUE;
65  }
66  }
67  }
68 
69  if (PartitionType == 0x42)
70  {
72  return TRUE;
73  }
74 
79  if (!NT_SUCCESS(Status))
80  {
82  return TRUE;
83  }
84 
86 
87  return TRUE;
88 }
#define IDS_SELECT_NO_PARTITION
Definition: resource.h:88
static int argc
Definition: ServiceArgs.c:12
BOOL HasPrefix(_In_ PWSTR pszString, _In_ PWSTR pszPrefix, _Out_opt_ PWSTR *pszSuffix)
Definition: misc.c:58
#define TRUE
Definition: types.h:120
uint16_t * PWSTR
Definition: typedefs.h:56
LONG NTSTATUS
Definition: precomp.h:26
static PPARTENTRY CurrentPartition
Definition: usetup.c:76
PDISKENTRY CurrentDisk
Definition: partlist.c:74
_Check_return_ unsigned long __cdecl wcstoul(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
#define argv
Definition: mplay32.c:18
int32_t INT
Definition: typedefs.h:58
#define IDS_ERROR_INVALID_ARGS
Definition: resource.h:187
#define L(x)
Definition: ntvdm.h:50
unsigned int BOOL
Definition: ntddk_ex.h:94
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
BOOLEAN Dirty
Definition: partlist.h:118
#define _In_
Definition: ms_sal.h:308
void ConResPuts(FILE *fp, UINT nID)
Definition: fc.c:27
static VOID UpdateDiskLayout(IN PDISKENTRY DiskEntry)
Definition: partlist.c:2534
Status
Definition: gdiplustypes.h:24
UCHAR PartitionType
Definition: partlist.h:53
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define IDS_SETID_INVALID_FORMAT
Definition: resource.h:98
#define IDS_SETID_SUCCESS
Definition: resource.h:97
#define IDS_SELECT_NO_DISK
Definition: resource.h:85
unsigned char UCHAR
Definition: xmlstorage.h:181
#define IDS_SETID_INVALID_TYPE
Definition: resource.h:99
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 NULL
Definition: types.h:112
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define StdOut
Definition: fc.c:14
NTSTATUS WritePartitions(IN PDISKENTRY DiskEntry)
Definition: partlist.c:3619
CHAR PartitionType
Definition: part_xbox.c:32
#define DPRINT
Definition: sndvol32.h:71
#define IDS_SETID_FAIL
Definition: resource.h:96
BOOL setid_main(_In_ INT argc, _In_ PWSTR *argv)
Definition: setid.c:16
#define StdErr
Definition: fc.c:15