| ︙ | | |
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
-
+
-
-
+
-
-
-
+
-
-
+
-
-
+
-
-
+
-
|
#define INHERITED_ACE (0x10)
#endif
/*
* Forward declarations of functions defined later in this file:
*/
static int TesteventloopCmd(ClientData dummy, Tcl_Interp* interp,
static Tcl_ObjCmdProc TesteventloopCmd;
int objc, Tcl_Obj *const objv[]);
static int TestvolumetypeCmd(ClientData dummy,
static Tcl_ObjCmdProc TestvolumetypeCmd;
Tcl_Interp *interp, int objc,
Tcl_Obj *const objv[]);
static int TestwinclockCmd(ClientData dummy, Tcl_Interp* interp,
static Tcl_ObjCmdProc TestwinclockCmd;
int objc, Tcl_Obj *const objv[]);
static int TestwinsleepCmd(ClientData dummy, Tcl_Interp* interp,
static Tcl_ObjCmdProc TestwinsleepCmd;
int objc, Tcl_Obj *const objv[]);
static int TestSizeCmd(ClientData dummy, Tcl_Interp* interp,
static Tcl_ObjCmdProc TestSizeCmd;
int objc, Tcl_Obj *const objv[]);
static Tcl_ObjCmdProc TestExceptionCmd;
static int TestplatformChmod(const char *nativePath, int pmode);
static int TestchmodCmd(ClientData dummy, Tcl_Interp* interp,
static Tcl_ObjCmdProc TestchmodCmd;
int objc, Tcl_Obj *const objv[]);
/*
*----------------------------------------------------------------------
*
* TclplatformtestInit --
*
* Defines commands that test platform specific functionality for Windows
|
| ︙ | | |
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
|
+
|
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
static int *framePtr = NULL;/* Pointer to integer on stack frame of
* innermost invocation of the "wait"
* subcommand. */
(void)clientData;
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "option ...");
return TCL_ERROR;
}
if (strcmp(Tcl_GetString(objv[1]), "done") == 0) {
*framePtr = 1;
|
| ︙ | | |
296
297
298
299
300
301
302
303
304
305
306
307
308
309
|
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
|
+
|
TestwinsleepCmd(
ClientData clientData, /* Unused */
Tcl_Interp* interp, /* Tcl interpreter */
int objc, /* Parameter count */
Tcl_Obj *const * objv) /* Parameter vector */
{
int ms;
(void)clientData;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "ms");
return TCL_ERROR;
}
if (Tcl_GetIntFromObj(interp, objv[1], &ms) != TCL_OK) {
return TCL_ERROR;
|
| ︙ | | |
381
382
383
384
385
386
387
388
389
390
391
392
393
394
|
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
|
+
|
EXCEPTION_INT_DIVIDE_BY_ZERO, EXCEPTION_INT_OVERFLOW,
EXCEPTION_PRIV_INSTRUCTION, EXCEPTION_IN_PAGE_ERROR,
EXCEPTION_ILLEGAL_INSTRUCTION, EXCEPTION_NONCONTINUABLE_EXCEPTION,
EXCEPTION_STACK_OVERFLOW, EXCEPTION_INVALID_DISPOSITION,
EXCEPTION_GUARD_PAGE, EXCEPTION_INVALID_HANDLE, CONTROL_C_EXIT
};
int cmd;
(void)dummy;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 0, objv, "<type-of-exception>");
return TCL_ERROR;
}
if (Tcl_GetIndexFromObj(interp, objv[1], cmds, "command", 0,
&cmd) != TCL_OK) {
|
| ︙ | | |
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
|
403
404
405
406
407
408
409
410
411
412
413
414
415
416
|
-
|
* main() where the process will now be terminated with this exception
* code by the default handler the C run-time provides.
*/
/* SMASH! */
RaiseException(exceptions[cmd], EXCEPTION_NONCONTINUABLE, 0, NULL);
/* NOTREACHED */
return TCL_OK;
}
/*
* This "chmod" works sufficiently for test script purposes. Do not expect
* it to be exact emulation of Unix chmod (not sure if that's even possible)
*/
|
| ︙ | | |
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
|
442
443
444
445
446
447
448
449
450
451
452
453
454
455
|
-
|
STANDARD_RIGHTS_READ | SYNCHRONIZE;
static const DWORD fileExecuteMask =
FILE_EXECUTE | STANDARD_RIGHTS_READ | SYNCHRONIZE;
DWORD attr, newAclSize;
PACL newAcl = NULL;
int res = 0;
SID_IDENTIFIER_AUTHORITY worldAuthority = SECURITY_WORLD_SID_AUTHORITY;
HANDLE hToken = NULL;
int i;
int nSids = 0;
struct {
PSID pSid;
DWORD mask;
|
| ︙ | | |
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
|
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
|
-
+
|
}
/* Get process SID */
if (!GetTokenInformation(hToken, TokenUser, NULL, 0, &dw) &&
GetLastError() != ERROR_INSUFFICIENT_BUFFER) {
goto done;
}
pTokenUser = ckalloc(dw);
pTokenUser = (TOKEN_USER *)ckalloc(dw);
if (!GetTokenInformation(hToken, TokenUser, pTokenUser, dw, &dw)) {
goto done;
}
aceEntry[nSids].sidLen = GetLengthSid(pTokenUser->User.Sid);
aceEntry[nSids].pSid = ckalloc(aceEntry[nSids].sidLen);
if (!CopySid(aceEntry[nSids].sidLen,
aceEntry[nSids].pSid,
|
| ︙ | | |
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
|
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
|
-
+
|
/* Get primary group SID */
if (!GetTokenInformation(
hToken, TokenPrimaryGroup, NULL, 0, &dw) &&
GetLastError() != ERROR_INSUFFICIENT_BUFFER) {
goto done;
}
pTokenGroup = ckalloc(dw);
pTokenGroup = (TOKEN_PRIMARY_GROUP *)ckalloc(dw);
if (!GetTokenInformation(hToken, TokenPrimaryGroup, pTokenGroup, dw, &dw)) {
ckfree(pTokenGroup);
goto done;
}
aceEntry[nSids].sidLen = GetLengthSid(pTokenGroup->PrimaryGroup);
aceEntry[nSids].pSid = ckalloc(aceEntry[nSids].sidLen);
if (!CopySid(aceEntry[nSids].sidLen, aceEntry[nSids].pSid, pTokenGroup->PrimaryGroup)) {
|
| ︙ | | |
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
|
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
|
-
+
|
newAclSize = sizeof(ACL);
/* Add in size required for each ACE entry in the ACL */
for (i = 0; i < nSids; ++i) {
newAclSize +=
offsetof(ACCESS_ALLOWED_ACE, SidStart) + aceEntry[i].sidLen;
}
newAcl = ckalloc(newAclSize);
newAcl = (PACL)ckalloc(newAclSize);
if (!InitializeAcl(newAcl, newAclSize, ACL_REVISION)) {
goto done;
}
for (i = 0; i < nSids; ++i) {
if (!AddAccessAllowedAce(newAcl, ACL_REVISION, aceEntry[i].mask, aceEntry[i].pSid)) {
goto done;
|
| ︙ | | |
664
665
666
667
668
669
670
671
672
673
674
675
676
677
|
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
|
+
|
TestchmodCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Parameter count */
Tcl_Obj *const * objv) /* Parameter vector */
{
int i, mode;
(void)dummy;
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "mode file ?file ...?");
return TCL_ERROR;
}
if (Tcl_GetIntFromObj(interp, objv[1], &mode) != TCL_OK) {
|
| ︙ | | |