Tcl Source Code

Check-in [81426bb3cd]
Login
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to [email protected]
or submit via the online form by Sep 9.

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:avoid dual init of stubs (possible race condition, 8.5th only)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | sebres-bug-9e6b569963-8-5-branch
Files: files | file ages | folders
SHA3-256: 81426bb3cdc7cef87fe144a32396773d415a09c2eb8db6debb5d366ebe82c8e5
User & Date: sebres 2018-05-25 15:48:50
Context
2018-05-25
15:51
minor indentation fix (no functional changes) Closed-Leaf check-in: aafdcb52e3 user: sebres tags: sebres-bug-9e6b569963-8-5-branch
15:48
avoid dual init of stubs (possible race condition, 8.5th only) check-in: 81426bb3cd user: sebres tags: sebres-bug-9e6b569963-8-5-branch
15:04
optimized winapi-stubs loading (8.5th only); if user name specified without domain and equals the cu... check-in: 19abe5efa2 user: sebres tags: sebres-bug-9e6b569963-8-5-branch
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to win/tclWinFile.c.

1432
1433
1434
1435
1436
1437
1438
1439

1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461

1462
1463
1464
1465
1466
1467
1468
    result = NULL;
    Tcl_DStringInit(bufferPtr);

    if (!apistubs) {
	HINSTANCE handle;
	TCL_DECLARE_MUTEX(initializeMutex)
	Tcl_MutexLock(&initializeMutex);


	handle = LoadLibraryA("netapi32.dll");
	if (handle) {
	    netApiBufferFreeProc = (NETAPIBUFFERFREEPROC *)
		GetProcAddress(handle, "NetApiBufferFree");
	    netGetDCNameProc = (NETGETDCNAMEPROC *)
		GetProcAddress(handle, "NetGetDCName");
	    netUserGetInfoProc = (NETUSERGETINFOPROC *)
		GetProcAddress(handle, "NetUserGetInfo");
	    Tcl_CreateExitHandler(TclpUnloadFile, handle);
	}
	handle = LoadLibraryA("userenv.dll");
	if (handle) {
	    getProfilesDirectoryProc = (GETPROFILESDIRECTORYPROC *)
		GetProcAddress(handle, "GetProfilesDirectoryW");
	    Tcl_CreateExitHandler(TclpUnloadFile, handle);
	}
	
	apistubs = -1;
	if ( (netUserGetInfoProc != NULL) && (netGetDCNameProc != NULL)
	  && (netApiBufferFreeProc != NULL) && (getProfilesDirectoryProc != NULL)
	) {
	    apistubs = 1;

	}
	Tcl_MutexUnlock(&initializeMutex);
    }

    if (apistubs == 1) {
	USER_INFO_1 *uiPtr;
	Tcl_DString ds;






<
>
|
|
|

|

|

|
|
|
|
|

|
|
|
|
|
|
|
|
>







1432
1433
1434
1435
1436
1437
1438

1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
    result = NULL;
    Tcl_DStringInit(bufferPtr);

    if (!apistubs) {
	HINSTANCE handle;
	TCL_DECLARE_MUTEX(initializeMutex)
	Tcl_MutexLock(&initializeMutex);

	if (!apistubs) {
	    handle = LoadLibraryA("netapi32.dll");
	    if (handle) {
		netApiBufferFreeProc = (NETAPIBUFFERFREEPROC *)
		GetProcAddress(handle, "NetApiBufferFree");
		netGetDCNameProc = (NETGETDCNAMEPROC *)
		GetProcAddress(handle, "NetGetDCName");
		netUserGetInfoProc = (NETUSERGETINFOPROC *)
		GetProcAddress(handle, "NetUserGetInfo");
		Tcl_CreateExitHandler(TclpUnloadFile, handle);
	    }
	    handle = LoadLibraryA("userenv.dll");
	    if (handle) {
		getProfilesDirectoryProc = (GETPROFILESDIRECTORYPROC *)
		GetProcAddress(handle, "GetProfilesDirectoryW");
		Tcl_CreateExitHandler(TclpUnloadFile, handle);
	    }
	    
	    apistubs = -1;
	    if ( (netUserGetInfoProc != NULL) && (netGetDCNameProc != NULL)
	      && (netApiBufferFreeProc != NULL) && (getProfilesDirectoryProc != NULL)
	    ) {
		apistubs = 1;
	    }
	}
	Tcl_MutexUnlock(&initializeMutex);
    }

    if (apistubs == 1) {
	USER_INFO_1 *uiPtr;
	Tcl_DString ds;