mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-03 05:08:14 +00:00
[os2/process]: Fix environment block null-terminator counting
This commit is contained in:
@@ -410,14 +410,15 @@ _get_process_user :: proc(process_handle: windows.HANDLE, allocator: runtime.All
|
|||||||
@(private)
|
@(private)
|
||||||
_parse_environment_block :: proc(block: [^]u16, allocator: runtime.Allocator) -> ([]string, Error) {
|
_parse_environment_block :: proc(block: [^]u16, allocator: runtime.Allocator) -> ([]string, Error) {
|
||||||
zt_count := 0
|
zt_count := 0
|
||||||
for idx := 0; true; idx += 1 {
|
for idx := 0; true; {
|
||||||
if block[idx] == 0x0000 {
|
if block[idx] == 0x0000 {
|
||||||
zt_count += 1
|
zt_count += 1
|
||||||
|
if block[idx+1] == 0x0000 {
|
||||||
|
zt_count += 1
|
||||||
|
break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if block[idx] == 0x0000 {
|
idx += 1
|
||||||
zt_count += 1
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// Note(flysand): Each string in the environment block is terminated
|
// Note(flysand): Each string in the environment block is terminated
|
||||||
// by a NUL character. In addition, the environment block itself is
|
// by a NUL character. In addition, the environment block itself is
|
||||||
|
|||||||
Reference in New Issue
Block a user