ReactOS  0.4.15-dev-4914-g2220e56
setid.c File Reference
#include "diskpart.h"
#include <debug.h>
Include dependency graph for setid.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

BOOL setid_main (_In_ INT argc, _In_ PWSTR *argv)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 11 of file setid.c.

Function Documentation

◆ setid_main()

BOOL setid_main ( _In_ INT  argc,
_In_ PWSTR argv 
)

Definition at line 16 of file setid.c.

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
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
BOOLEAN Dirty
Definition: partlist.h:118
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
#define StdErr
Definition: fc.c:15