| ︙ | | |
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
|
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
|
-
+
|
GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL, NULL);
if (hFile == INVALID_HANDLE_VALUE) {
continue;
}
header.e_magic = 0;
ReadFile(hFile, (void *) &header, sizeof(header), &read, NULL);
ReadFile(hFile, (void *)&header, sizeof(header), &read, NULL);
if (header.e_magic != IMAGE_DOS_SIGNATURE) {
/*
* Doesn't have the magic number for relocatable executables. If
* filename ends with .com, assume it's a DOS application anyhow.
* Note that we didn't make this assumption at first, because some
* supposed .com files are really 32-bit executables with all the
* magic numbers and everything.
|
| ︙ | | |
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
|
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
|
-
+
|
/*
* The DWORD at header.e_lfanew points to yet another magic number.
*/
buf[0] = '\0';
SetFilePointer(hFile, header.e_lfanew, NULL, FILE_BEGIN);
ReadFile(hFile, (void *) buf, 2, &read, NULL);
ReadFile(hFile, (void *)buf, 2, &read, NULL);
CloseHandle(hFile);
if ((buf[0] == 'N') && (buf[1] == 'E')) {
applType = APPL_WIN3X;
} else if ((buf[0] == 'P') && (buf[1] == 'E')) {
applType = APPL_WIN32;
} else {
|
| ︙ | | |
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
|
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
|
-
+
-
+
|
if (!CreatePipe(&readHandle, &writeHandle, &sec, 0)) {
Tcl_WinConvertError(GetLastError());
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"pipe creation failed: %s", Tcl_PosixError(interp)));
return TCL_ERROR;
}
*rchan = Tcl_MakeFileChannel((void *) readHandle, TCL_READABLE);
*rchan = Tcl_MakeFileChannel((void *)readHandle, TCL_READABLE);
Tcl_RegisterChannel(interp, *rchan);
*wchan = Tcl_MakeFileChannel((void *) writeHandle, TCL_WRITABLE);
*wchan = Tcl_MakeFileChannel((void *)writeHandle, TCL_WRITABLE);
Tcl_RegisterChannel(interp, *wchan);
return TCL_OK;
}
/*
*----------------------------------------------------------------------
|
| ︙ | | |
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
|
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
|
-
+
|
* Wrap the error file into a channel and give it to the cleanup
* routine.
*/
if (pipePtr->errorFile) {
WinFile *filePtr = (WinFile *) pipePtr->errorFile;
errChan = Tcl_MakeFileChannel((void *) filePtr->handle,
errChan = Tcl_MakeFileChannel((void *)filePtr->handle,
TCL_READABLE);
Tcl_Free(filePtr);
} else {
errChan = NULL;
}
result = TclCleanupChildren(interp, pipePtr->numPids,
|
| ︙ | | |
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
|
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
|
-
+
-
+
|
void **handlePtr) /* Where to store the handle. */
{
PipeInfo *infoPtr = (PipeInfo *) instanceData;
WinFile *filePtr;
if (direction == TCL_READABLE && infoPtr->readFile) {
filePtr = (WinFile*) infoPtr->readFile;
*handlePtr = (void *) filePtr->handle;
*handlePtr = (void *)filePtr->handle;
return TCL_OK;
}
if (direction == TCL_WRITABLE && infoPtr->writeFile) {
filePtr = (WinFile*) infoPtr->writeFile;
*handlePtr = (void *) filePtr->handle;
*handlePtr = (void *)filePtr->handle;
return TCL_OK;
}
return TCL_ERROR;
}
/*
*----------------------------------------------------------------------
|
| ︙ | | |
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
|
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
|
-
+
|
if (resultingNameObj) {
Tcl_Obj *tmpObj = TclpNativeToNormalized(name);
Tcl_AppendObjToObj(resultingNameObj, tmpObj);
TclDecrRefCount(tmpObj);
}
return Tcl_MakeFileChannel((void *) handle,
return Tcl_MakeFileChannel((void *)handle,
TCL_READABLE|TCL_WRITABLE);
gotError:
Tcl_WinConvertError(GetLastError());
return NULL;
}
|
| ︙ | | |