summaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>2000-08-21 05:56:13 +0000
committerGurusamy Sarathy <gsar@cpan.org>2000-08-21 05:56:13 +0000
commit19c81aacf4756efdf4567e39db89e8c0ffbd1b19 (patch)
tree9704704f8b56285046197d00cf59b6ef2d0e7289 /win32
parent63274c34f515572c9729e8c72e1fb9293a7f0731 (diff)
downloadperl-19c81aacf4756efdf4567e39db89e8c0ffbd1b19.tar.gz
small tweaks for change#6705: avoid C++ style comments in C code;
use Perl's malloc API rather than the low level system one p4raw-link: @6705 on //depot/perl: d12db45c09c7b1994500d95b22b3635ca28bfffb p4raw-id: //depot/perl@6738
Diffstat (limited to 'win32')
-rw-r--r--win32/win32.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/win32/win32.c b/win32/win32.c
index f0f629e0ec..ead206b042 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -3715,36 +3715,36 @@ XS(w32_DomainName)
EXTEND(SP,1);
ST(0) = &PL_sv_undef;
- // Get the calling thread's access token.
+ /* Get the calling thread's access token. */
if (!OpenThreadToken(GetCurrentThread(), TOKEN_QUERY, TRUE, &hToken)) {
if (GetLastError() != ERROR_NO_TOKEN)
goto leave;
- // Retry against process token if no thread token exists.
+ /* Retry against process token if no thread token exists. */
if (!OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &hToken))
goto leave;
}
- // Obtain the size of the user information in the token.
+ /* Obtain the size of the user information in the token. */
if (GetTokenInformation(hToken, TokenUser, NULL, 0, &cbti)) {
- // Call should have failed due to zero-length buffer.
+ /* Call should have failed due to zero-length buffer. */
goto leave;
}
else {
- // Call should have failed due to zero-length buffer.
+ /* Call should have failed due to zero-length buffer. */
if (GetLastError() != ERROR_INSUFFICIENT_BUFFER)
goto leave;
}
- // Allocate buffer for user information in the token.
- ptiUser = (PTOKEN_USER) HeapAlloc(GetProcessHeap(), 0, cbti);
+ /* Allocate buffer for user information in the token. */
+ Newc(0, ptiUser, cbti, char, TOKEN_USER);
if (!ptiUser)
goto leave;
- // Retrieve the user information from the token.
+ /* Retrieve the user information from the token. */
if (!GetTokenInformation(hToken, TokenUser, ptiUser, cbti, &cbti))
goto leave;
- // Retrieve user name and domain name based on user's SID.
+ /* Retrieve user name and domain name based on user's SID. */
if (!LookupAccountSid(NULL, ptiUser->User.Sid, szUser, &cchUser,
szDomain, &cchDomain, &snu))
goto leave;
@@ -3755,8 +3755,7 @@ XS(w32_DomainName)
if (hToken)
CloseHandle(hToken);
- if (ptiUser)
- HeapFree(GetProcessHeap(), 0, ptiUser);
+ Safefree(ptiUser);
XSRETURN(1);
}