ReactOS 0.4.16-dev-199-g898cc56
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
15BOOL
19{
21 INT i, length;
22 PWSTR pszSuffix = NULL;
24
25 DPRINT("SetId()\n");
26
27 if (CurrentDisk == NULL)
28 {
30 return TRUE;
31 }
32
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}
static int argc
Definition: ServiceArgs.c:12
#define StdOut
Definition: fc.c:14
#define StdErr
Definition: fc.c:15
void ConResPuts(FILE *fp, UINT nID)
Definition: fc.c:27
LONG NTSTATUS
Definition: precomp.h:26
#define IDS_SETID_INVALID_TYPE
Definition: resource.h:99
#define IDS_SETID_FAIL
Definition: resource.h:96
#define IDS_SELECT_NO_PARTITION
Definition: resource.h:88
#define IDS_SETID_SUCCESS
Definition: resource.h:97
#define IDS_ERROR_INVALID_ARGS
Definition: resource.h:187
#define IDS_SETID_INVALID_FORMAT
Definition: resource.h:98
#define IDS_SELECT_NO_DISK
Definition: resource.h:85
BOOL HasPrefix(_In_ PWSTR pszString, _In_ PWSTR pszPrefix, _Out_opt_ PWSTR *pszSuffix)
Definition: misc.c:58
PDISKENTRY CurrentDisk
Definition: partlist.c:74
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
unsigned int BOOL
Definition: ntddk_ex.h:94
Status
Definition: gdiplustypes.h:25
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
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
_Check_return_ unsigned long __cdecl wcstoul(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define argv
Definition: mplay32.c:18
#define _In_
Definition: ms_sal.h:308
#define L(x)
Definition: ntvdm.h:50
CHAR PartitionType
Definition: part_xbox.c:32
BOOL setid_main(_In_ INT argc, _In_ PWSTR *argv)
Definition: setid.c:16
static VOID UpdateDiskLayout(IN PDISKENTRY DiskEntry)
Definition: partlist.c:2585
NTSTATUS WritePartitions(IN PDISKENTRY DiskEntry)
Definition: partlist.c:3587
#define DPRINT
Definition: sndvol32.h:73
BOOLEAN Dirty
Definition: partlist.h:136
UCHAR PartitionType
Definition: partlist.h:73
uint16_t * PWSTR
Definition: typedefs.h:56
int32_t INT
Definition: typedefs.h:58
static PPARTENTRY CurrentPartition
Definition: usetup.c:78
unsigned char UCHAR
Definition: xmlstorage.h:181