This commit is contained in:
gingerBill
2021-11-13 19:07:27 +00:00
9 changed files with 123 additions and 18 deletions
+10 -6
View File
@@ -115,12 +115,16 @@ cleanpath_strip_prefix :: proc(buf: []u16) -> []u16 {
}
buf = buf[:N]
if len(buf) >= 4 {
if buf[0] == '\\' &&
buf[1] == '\\' &&
buf[2] == '?' &&
buf[3] == '\\' {
buf = buf[4:]
if len(buf) >= 4 && buf[0] == '\\' && buf[1] == '\\' && buf[2] == '?' && buf[3] == '\\' {
buf = buf[4:]
/*
NOTE(Jeroen): Properly handle UNC paths.
We need to turn `\\?\UNC\synology.local` into `\\synology.local`.
*/
if len(buf) >= 3 && buf[0] == 'U' && buf[1] == 'N' && buf[2] == 'C' {
buf = buf[2:]
buf[0] = '\\'
}
}
return buf
+8 -3
View File
@@ -39,6 +39,11 @@ foreign ws2_32 {
g: GROUP,
dwFlags: DWORD,
) -> SOCKET ---
socket :: proc(
af: c_int,
type: c_int,
protocol: c_int,
) -> SOCKET ---
ioctlsocket :: proc(s: SOCKET, cmd: c_long, argp: ^c_ulong) -> c_int ---
closesocket :: proc(socket: SOCKET) -> c_int ---
@@ -76,10 +81,10 @@ foreign ws2_32 {
listen :: proc(socket: SOCKET, backlog: c_int) -> c_int ---
connect :: proc(socket: SOCKET, address: ^SOCKADDR, len: c_int) -> c_int ---
getaddrinfo :: proc(
node: ^c_char,
service: ^c_char,
node: cstring,
service: cstring,
hints: ^ADDRINFOA,
res: ^ADDRINFOA,
res: ^^ADDRINFOA,
) -> c_int ---
freeaddrinfo :: proc(res: ^ADDRINFOA) ---
select :: proc(