Left: | ||
Right: |
OLD | NEW |
---|---|
1 // Copyright 2011 The Go Authors. All rights reserved. | 1 // Copyright 2011 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 package syscall | 5 package syscall |
6 | 6 |
7 const ( | 7 const ( |
8 // Windows errors. | 8 // Windows errors. |
9 ERROR_FILE_NOT_FOUND Errno = 2 | 9 ERROR_FILE_NOT_FOUND Errno = 2 |
10 ERROR_PATH_NOT_FOUND Errno = 3 | 10 ERROR_PATH_NOT_FOUND Errno = 3 |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
331 // convert into 100-nanosecond | 331 // convert into 100-nanosecond |
332 nsec /= 100 | 332 nsec /= 100 |
333 // change starting time to January 1, 1601 | 333 // change starting time to January 1, 1601 |
334 nsec += 116444736000000000 | 334 nsec += 116444736000000000 |
335 // split into high / low | 335 // split into high / low |
336 ft.LowDateTime = uint32(nsec & 0xffffffff) | 336 ft.LowDateTime = uint32(nsec & 0xffffffff) |
337 ft.HighDateTime = uint32(nsec >> 32 & 0xffffffff) | 337 ft.HighDateTime = uint32(nsec >> 32 & 0xffffffff) |
338 return ft | 338 return ft |
339 } | 339 } |
340 | 340 |
341 // Win32finddata is an incorrect struct definition, preserved for | |
342 // backwards compatibility. Use Win32finddata1 and the | |
343 // FindFirstFile1 and FindNextFile1 functions instead. | |
344 type Win32finddata struct { | 341 type Win32finddata struct { |
345 FileAttributes uint32 | 342 FileAttributes uint32 |
346 CreationTime Filetime | 343 CreationTime Filetime |
347 LastAccessTime Filetime | 344 LastAccessTime Filetime |
348 LastWriteTime Filetime | 345 LastWriteTime Filetime |
349 FileSizeHigh uint32 | 346 FileSizeHigh uint32 |
350 FileSizeLow uint32 | 347 FileSizeLow uint32 |
351 Reserved0 uint32 | 348 Reserved0 uint32 |
352 Reserved1 uint32 | 349 Reserved1 uint32 |
353 FileName [MAX_PATH - 1]uint16 | 350 FileName [MAX_PATH - 1]uint16 |
354 AlternateFileName [13]uint16 | 351 AlternateFileName [13]uint16 |
355 } | 352 } |
356 | 353 |
357 type Win32finddata1 struct { | 354 // This is the actual system call structure. |
355 // Win32finddata is what we committed to in Go 1. | |
356 type win32finddata1 struct { | |
358 FileAttributes uint32 | 357 FileAttributes uint32 |
359 CreationTime Filetime | 358 CreationTime Filetime |
360 LastAccessTime Filetime | 359 LastAccessTime Filetime |
361 LastWriteTime Filetime | 360 LastWriteTime Filetime |
362 FileSizeHigh uint32 | 361 FileSizeHigh uint32 |
363 FileSizeLow uint32 | 362 FileSizeLow uint32 |
364 Reserved0 uint32 | 363 Reserved0 uint32 |
365 Reserved1 uint32 | 364 Reserved1 uint32 |
366 FileName [MAX_PATH]uint16 | 365 FileName [MAX_PATH]uint16 |
367 AlternateFileName [14]uint16 | 366 AlternateFileName [14]uint16 |
368 } | 367 } |
369 | 368 |
369 func copyFindData(dst *Win32finddata, src *win32finddata1) { | |
370 dst.FileAttributes = src.FileAttributes | |
371 dst.CreationTime = src.CreationTime | |
372 dst.LastAccessTime = src.LastAccessTime | |
373 dst.LastWriteTime = src.LastWriteTime | |
374 dst.FileSizeHigh = src.FileSizeHigh | |
375 dst.FileSizeLow = src.FileSizeLow | |
376 dst.Reserved0 = src.Reserved0 | |
377 dst.Reserved1 = src.Reserved1 | |
378 | |
379 // The src is 1 element shorter than dst. Zero that last one. | |
380 copy(dst.FileName[:], src.FileName[:]) | |
381 dst.FileName[len(dst.FileName)-1] = 0 | |
brainman
2012/06/09 12:15:31
You should not override last char of FileName with
| |
382 copy(dst.AlternateFileName[:], src.AlternateFileName[:]) | |
383 src.AlternateFileName[len(dst.AlternateFileName)-1] = 0 | |
brainman
2012/06/09 12:15:31
This line must be wrong. Why are you changing src?
| |
384 } | |
385 | |
370 type ByHandleFileInformation struct { | 386 type ByHandleFileInformation struct { |
371 FileAttributes uint32 | 387 FileAttributes uint32 |
372 CreationTime Filetime | 388 CreationTime Filetime |
373 LastAccessTime Filetime | 389 LastAccessTime Filetime |
374 LastWriteTime Filetime | 390 LastWriteTime Filetime |
375 VolumeSerialNumber uint32 | 391 VolumeSerialNumber uint32 |
376 FileSizeHigh uint32 | 392 FileSizeHigh uint32 |
377 FileSizeLow uint32 | 393 FileSizeLow uint32 |
378 NumberOfLinks uint32 | 394 NumberOfLinks uint32 |
379 FileIndexHigh uint32 | 395 FileIndexHigh uint32 |
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
902 REG_DWORD_BIG_ENDIAN | 918 REG_DWORD_BIG_ENDIAN |
903 REG_LINK | 919 REG_LINK |
904 REG_MULTI_SZ | 920 REG_MULTI_SZ |
905 REG_RESOURCE_LIST | 921 REG_RESOURCE_LIST |
906 REG_FULL_RESOURCE_DESCRIPTOR | 922 REG_FULL_RESOURCE_DESCRIPTOR |
907 REG_RESOURCE_REQUIREMENTS_LIST | 923 REG_RESOURCE_REQUIREMENTS_LIST |
908 REG_QWORD_LITTLE_ENDIAN | 924 REG_QWORD_LITTLE_ENDIAN |
909 REG_DWORD = REG_DWORD_LITTLE_ENDIAN | 925 REG_DWORD = REG_DWORD_LITTLE_ENDIAN |
910 REG_QWORD = REG_QWORD_LITTLE_ENDIAN | 926 REG_QWORD = REG_QWORD_LITTLE_ENDIAN |
911 ) | 927 ) |
OLD | NEW |