This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# create test.txt in temp folder | |
$filename = Join-Path -Path $env:temp -ChildPath 'test.txt' | |
# make sure the file exists | |
"" | Out-File -LiteralPath $filename | |
# Open the file with Share options only allowing read... | |
$f = [System.IO.File]::Open($filename, 'Open', 'Read', 'Read') | |
"File $fileName is in use and locked" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function GetObjectName(const hObject: THandle): String; | |
var | |
oni: OBJECT_NAME_INFORMATION; | |
cbSize: DWORD; | |
nts: NTSTATUS; | |
begin | |
Result := ''; | |
cbSize := SizeOf(oni) - (2 * SizeOf(USHORT)); |