| 3336 | # __out LPTSTR lpBuffer |
| 3337 | # ); |
| 3338 | def GetTempPathA(): |
| 3339 | _GetTempPathA = windll.kernel32.GetTempPathA |
| 3340 | _GetTempPathA.argtypes = [DWORD, LPSTR] |
| 3341 | _GetTempPathA.restype = DWORD |
| 3342 | |
| 3343 | nBufferLength = _GetTempPathA(0, None) |
| 3344 | if nBufferLength <= 0: |
| 3345 | raise ctypes.WinError() |
| 3346 | lpBuffer = ctypes.create_string_buffer("", nBufferLength) |
| 3347 | nCopied = _GetTempPathA(nBufferLength, lpBuffer) |
| 3348 | if nCopied > nBufferLength or nCopied == 0: |
| 3349 | raise ctypes.WinError() |
| 3350 | return lpBuffer.value |
| 3351 | |
| 3352 | |
| 3353 | def GetTempPathW(): |