The Samba-Bugzilla – Attachment 778 Details for
Bug 2045
File timestamps inconsistent
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
Small test app (c++)
SambaTest.cpp (text/plain), 1.82 KB, created by
Hartmut Honisch
on 2004-11-17 07:34:22 UTC
(
hide
)
Description:
Small test app (c++)
Filename:
MIME Type:
Creator:
Hartmut Honisch
Created:
2004-11-17 07:34:22 UTC
Size:
1.82 KB
patch
obsolete
>// SambaTest.cpp : Defines the entry point for the console application. >// > >#include <windows.h> >#include <stdio.h> > >int main(int argc, char* argv[]) >{ > int result = 1; > char filename[] = "testfile.tmp"; > FILETIME ft; > SYSTEMTIME st; > HANDLE hFile = INVALID_HANDLE_VALUE; > HANDLE hFindFile = INVALID_HANDLE_VALUE; > WIN32_FIND_DATA fd; > > // Create new file > hFile = CreateFile(filename, GENERIC_READ | GENERIC_WRITE, 0, 0, CREATE_ALWAYS, > FILE_ATTRIBUTE_NORMAL, 0); > if (hFile == INVALID_HANDLE_VALUE) > { > goto End; > } > printf("Created file %s\n", filename); > > // set to 1.1.2005 00:00 > ZeroMemory(&st, sizeof(st)); > st.wDay = 1; > st.wMonth = 1; > st.wYear = 2005; > if (!(SystemTimeToFileTime(&st, &ft) && SetFileTime(hFile, 0, 0, &ft))) > { > goto End; > } > printf("Set filetime (UTC) to %2.2d.%2.2d.%4.4d %2.2d:%2.2d\n", > st.wDay, st.wMonth, st.wYear, st.wHour, st.wMinute); > > // Close file > CloseHandle(hFile); > hFile = INVALID_HANDLE_VALUE; > printf("Closed file %s\n\n", filename); > > > // Open existing file > hFindFile = FindFirstFile(filename, &fd); > if (hFindFile == INVALID_HANDLE_VALUE) > { > FindClose(hFindFile); > goto End; > } > FindClose(hFindFile); > printf("Found file %s\n", filename); > > // read and convert file time > if (!FileTimeToSystemTime(&fd.ftLastWriteTime, &st)) > { > goto End; > } > printf("Read filetime (UTC): %2.2d.%2.2d.%4.4d %2.2d:%2.2d\n", > st.wDay, st.wMonth, st.wYear, st.wHour, st.wMinute); > > result = 0; >End: > if (hFile != INVALID_HANDLE_VALUE) > { > CloseHandle(hFile); > printf("Closed file %s\n\n", filename); > } > > if (result != 0) > { > printf("Error\n"); > } > printf("\nHit <enter> to terminate\n"); > getchar(); >} >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 2045
: 778 |
801