Prev: Is it possible to determine (programmatically) if system wasjust powered up or rebooted
Next: Simple hack to get $500 to your home.
From: io_x on 21 Jul 2010 04:44 "Gernot Frisch" <me(a)privacy.net> ha scritto nel messaggio news:8a3b85F6isU1(a)mid.individual.net... > Hi, > > when I try to do: > FindFirstFile(_T("C:\\Users\\gf\\Anwendungsdaten\\*.*", &fnd) > it returns NULL (Last error yields "access denied"). > > "C:\Users\gf\Anwendungsdaten" is a reparse point targeting > "C:\Users\gf\Roaming". > > OK, I can find the target and all. Fine. > > BUT!!! > FindFirstFile(_T("C:\\Users\\gf\\Anwendungsdaten\\Adobe\\*.*", &fnd) > > works perfeclty and it's no reparse point, although it is accessed trough > such. > > My code works flawlessly, but I'm a bit unsure if this behaviour is correct > now. > > Thank you for sheding light. so in win32 what is the way for parse the content of one directory? i have to call FindFirstFileA("C:\\Users\\gf\\Anwendungsdaten\\*.*", &fnd) and that function return the sub-directory name too? or can CreateFile(name of dirctory) return one handle that allow to read the content of that directory? thank you > -- > ------------------------------------ > Gernot Frisch > http://www.glbasic.com >
From: Jackie on 21 Jul 2010 05:44 io_x wrote: > "Gernot Frisch"<me(a)privacy.net> ha scritto nel messaggio > news:8a3b85F6isU1(a)mid.individual.net... >> Hi, >> >> when I try to do: >> FindFirstFile(_T("C:\\Users\\gf\\Anwendungsdaten\\*.*",&fnd) >> it returns NULL (Last error yields "access denied"). >> >> "C:\Users\gf\Anwendungsdaten" is a reparse point targeting >> "C:\Users\gf\Roaming". >> >> OK, I can find the target and all. Fine. >> >> BUT!!! >> FindFirstFile(_T("C:\\Users\\gf\\Anwendungsdaten\\Adobe\\*.*",&fnd) >> >> works perfeclty and it's no reparse point, although it is accessed trough >> such. >> >> My code works flawlessly, but I'm a bit unsure if this behaviour is correct >> now. >> >> Thank you for sheding light. > > so in win32 what is the way for parse the content of one directory? > i have to call FindFirstFileA("C:\\Users\\gf\\Anwendungsdaten\\*.*",&fnd) > and that function return the sub-directory name too? > > or can CreateFile(name of dirctory) return one handle that allow > to read the content of that directory? > > thank you > >> -- >> ------------------------------------ >> Gernot Frisch >> http://www.glbasic.com I read somewhere before that you get "access denied" errors to prevent going over the exact same files more than one time. These reparse points allow access to sub-directories for backwards compatibility with older applications which uses hardcoded paths. "Determining Whether a Directory Is a Mounted Folder" on MSDN: http://msdn.microsoft.com/en-us/library/aa363940(v=VS.85).aspx -- Regards, Jackie
From: Jackie on 21 Jul 2010 05:48 Jackie wrote: > "Determining Whether a Directory Is a Mounted Folder" on MSDN: > http://msdn.microsoft.com/en-us/library/aa363940(v=VS.85).aspx > This is an article on mounted folders but reparse points are used to implement mounted folders. Some more on reparse points: http://msdn.microsoft.com/en-us/library/aa365503(v=VS.85).aspx -- Regards, Jackie
From: io_x on 22 Jul 2010 10:19
"io_x" <a(a)b.c.invalid> ha scritto nel messaggio news:4c46b11d$0$40287$4fafbaef(a)reader2.news.tin.it... > > "Gernot Frisch" <me(a)privacy.net> ha scritto nel messaggio > news:8a3b85F6isU1(a)mid.individual.net... >> Hi, >> >> when I try to do: >> FindFirstFile(_T("C:\\Users\\gf\\Anwendungsdaten\\*.*", &fnd) >> it returns NULL (Last error yields "access denied"). >> >> "C:\Users\gf\Anwendungsdaten" is a reparse point targeting >> "C:\Users\gf\Roaming". >> >> OK, I can find the target and all. Fine. >> >> BUT!!! >> FindFirstFile(_T("C:\\Users\\gf\\Anwendungsdaten\\Adobe\\*.*", &fnd) >> >> works perfeclty and it's no reparse point, although it is accessed trough >> such. >> >> My code works flawlessly, but I'm a bit unsure if this behaviour is correct >> now. >> >> Thank you for sheding light. > > so in win32 what is the way for parse the content of one directory? > i have to call FindFirstFileA("C:\\Users\\gf\\Anwendungsdaten\\*.*", &fnd) > and that function return the sub-directory name too? yes FindFirstFileA(), FindNextFileA() FindClose() as the example in the win32.hlp WIN32_FIND_DATA FileData; HANDLE hSearch; DWORD dwAttrs; char szDirPath[] = "c:\\TEXTRO\\"; char szNewPath[MAX_PATH]; char szHome[MAX_PATH]; BOOL fFinished = FALSE; // Create a new directory. if (!CreateDirectory(szDirPath, NULL)) { ErrorHandler("Couldn't create new directory."); } // Start searching for .TXT files in the current directory. hSearch = FindFirstFile("*.txt", &FileData); if (hSearch == INVALID_HANDLE_VALUE) { ErrorHandler("No .TXT files found."); } // Copy each .TXT file to the new directory // and change it to read only, if not already. while (!fFinished) { lstrcpy(szNewPath, szDirPath); lstrcat(szNewPath, FileData.cFileName); if (CopyFile(FileData.cFileName, szNewPath, FALSE)) { dwAttrs = GetFileAttributes(FileData.cFileName); if (!(dwAttrs & FILE_ATTRIBUTE_READONLY)) { SetFileAttributes(szNewPath, dwAttrs | FILE_ATTRIBUTE_READONLY); } } else { ErrorHandler("Couldn't copy file."); } if (!FindNextFile(hSearch, &FileData)) if (GetLastError() == ERROR_NO_MORE_FILES) { MessageBox(hwnd, "No more .TXT files.", "Search completed.", MB_OK); fFinished = TRUE; } else { ErrorHandler("Couldn't find next file."); } } // Close the search handle. if (!FindClose(hSearch)) { ErrorHandler("Couldn't close search handle."); } > or can CreateFile(name of dirctory) return one handle that allow > to read the content of that directory? > > thank you > >> -- >> ------------------------------------ >> Gernot Frisch >> http://www.glbasic.com >> > > > |