質問

C++Builderは、2007年のFindFirstFileとFindNextFile機能するという事を見つけることができまファイルを64ビット版のwindows Vista、XP.私の試験に適用する32ビットとしています。

を利用した場合、その反復処理のフォルダC:\Windows\System32\Drivers 彼らはボランティアをや一部のファイルがありま185時発行dirコマンドコマンド入力します。同じコード例は、リストのすべてのファイルアプリコット、32ビット版ださい。

ここではプログラム:

int main(int argc, char* argv[])
{
  HANDLE hFind;
  WIN32_FIND_DATA FindData;
  int ErrorCode;
  bool cont = true;

  cout << "FindFirst/Next demo." << endl << endl;

  hFind = FindFirstFile("*.*", &FindData);
  if(hFind == INVALID_HANDLE_VALUE)
  {
    ErrorCode = GetLastError();
    if (ErrorCode == ERROR_FILE_NOT_FOUND)
    {
      cout << "There are no files matching that path/mask\n" << endl;
    }
    else
    {
      cout << "FindFirstFile() returned error code " << ErrorCode << endl;
    }
    cont = false;
  }
  else
  {
    cout << FindData.cFileName << endl;
  }

  if (cont)
  {
    while (FindNextFile(hFind, &FindData))
    {
      cout << FindData.cFileName << endl;
    }

    ErrorCode = GetLastError();
    if (ErrorCode == ERROR_NO_MORE_FILES)
    {
      cout << endl << "All files logged." << endl;
    }
    else
    {
      cout << "FindNextFile() returned error code " << ErrorCode << endl;
    }

    if (!FindClose(hFind))
    {
      ErrorCode = GetLastError();
      cout << "FindClose() returned error code " << ErrorCode << endl;
    }
  }
  return 0;
}

走行でのC:\Windows\System32\Drivers フォルダの64ビットXPを返します:

C:\WINDOWS\system32\drivers>t:\Project1.exe
FindFirst/Next demo.

.
..
AsIO.sys
ASUSHWIO.SYS
hfile.txt
raspti.zip
stcp2v30.sys
truecrypt.sys

All files logged.

Dirコマンドと同じシステムを返します:

C:\WINDOWS\system32\drivers>dir/p
 Volume in drive C has no label.
 Volume Serial Number is E8E1-0F1E

 Directory of C:\WINDOWS\system32\drivers

16-09-2008  23:12    <DIR>          .
16-09-2008  23:12    <DIR>          ..
17-02-2007  00:02            80.384 1394bus.sys
16-09-2008  23:12             9.453 a.txt
17-02-2007  00:02           322.560 acpi.sys
29-03-2006  14:00            18.432 acpiec.sys
24-03-2005  17:11           188.928 aec.sys
21-06-2008  15:07           291.840 afd.sys
29-03-2006  14:00            51.712 amdk8.sys
17-02-2007  00:03           111.104 arp1394.sys
08-05-2006  20:19             8.192 ASACPI.sys
29-03-2006  14:00            25.088 asyncmac.sys
17-02-2007  00:03           150.016 atapi.sys
17-02-2007  00:03           106.496 atmarpc.sys
29-03-2006  14:00            57.344 atmepvc.sys
17-02-2007  00:03            91.648 atmlane.sys
17-02-2007  00:03           569.856 atmuni.sys
24-03-2005  19:12             5.632 audstub.sys
29-03-2006  14:00             6.144 beep.sys
Press any key to continue . . .
etc.

私は戸惑.である理由は何ですか。

Brian

役に立ちましたか?

解決

あるリダイレクト。の発言があWow64DisableWow64FsRedirection http://msdn.microsoft.com/en-gb/library/aa365743.aspx

他のヒント

ここにMSDN:

を書いていて32bitアプリケーションをリストしているため、すべてのファイルディレクトリおよびアプリケーションは実行される64bitコンピュータ、まる電話番号にご連絡いただきWow64DisableWow64FsRedirectionfunctionを呼び出す前に、FindFirstFileコWow64RevertWow64FsRedirection最後の呼び出FindNextFile.詳細については、ファイルシステムRedirector.

こちらのリンク

よって詐欺サイトだと思いデコードです:-)

をしていますので見ると同じディレクトリdirコマンド?なされているわけではなさそうだファイルに共通している。

また、このなので、正しいワイルドカード"のすべてのファイル"とは*

*.* ことのすべてのファイルの限りでない。の名前"

あるときに警告すコンパイル?

いっ すべての 警告のためにこの特定の試験で働いていない)?

必ず最初に下方修正を発表している。

問題ありませんが、例のコードです。私は別のアプリケーションにエラーが発生した場合も、ご利用いただけます:standardとexpress。私の答えを見つづムのクリス'についてお答えリダイレクション:http://msdn.microsoft.com/en-gb/library/aa364418(VS.85).aspx

わかった:

http://msdn.microsoft.com/en-gb/library/aa384187(VS.85).aspx

場合は、32bitアプリケーションを読み込みの中からこれらのフォルダに64ビットOS:

%windir%\system32\catroot
%windir%\system32\catroot2
%windir%\system32\drivers\etc
%windir%\system32\logfiles
%windir%\system32\spool 

Windowsで実際にリストの内容:

%windir%\SysWOW64\catroot
%windir%\SysWOW64\catroot2
%windir%\SysWOW64\drivers\etc
%windir%\SysWOW64\logfiles
%windir%\SysWOW64\spool 

おムのクリス入力したティーチング-アシスタントに出でいるのかもしれません。

編集:まLudvigもの:-)

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top