CreateFile,WriteFile,CloseHandle,GetSystemDirectory

var

  Qchar:array[0..254] of Char;

  handle:HFILE;

  WriteNo:DWORD;

begin

  getsystemDirectory(Qchar,255);

  handle:=CreateFile('SystemRoot.txt',

    GENERIC_WRITE,

    0,

    0,

    CREATE_ALWAYS,

    FILE_ATTRIBUTE_NORMAL,

    0);

  if handle<>INVALID_HANDLE_VALUE then

  begin

    if WriteFile(handle,qchar,lstrlen(Qchar),WriteNo,0) then

      ShowMessage(IntToStr(GetLastError));

  end;

  CloseHandle(handle);

end;

 

你可能感兴趣的:(Directory)