因为目的很简单,就是向system32下的2个ini文件中写东西,所以不想使用Form,这样编译出来的程序小,而且也实现我想要的功能就可以了。但是我的代码出现异常,报错:
---------------------------
Application Error
---------------------------
Exception EAccessViolation in module ntdll.dll at 000120E6.Access violation at address 7C9320E6 in module 'ntdll.dll'. Write of address 004040E1.
---------------------------
确定   
---------------------------
program Writeini;uses
  Windows,
  SysUtils,
  IniFiles;{$R *.res}
const PublictProduct = 'ShineDeliver_Public';
var
  FWindowPath, FProductID, FProductPath: string;function GetWindowsDir: string;
var
  pSystemPath: array[0..255] of Char;
begin
  GetWindowsDirectory(pSystemPath, SizeOf(pSystemPath));
  Result := StrPas(pSystemPath);
end;
procedure WriteAppserverInfo;
var
  AppServer: TIniFile;
  FileBool: Boolean;
begin
  try
    FileBool := FileExists(FWindowPath + '\System32\xxx.ini');//测试用
    AppServer := TIniFile.Create(FWindowPath + '\System32\xxx.ini');
    AppServer.WriteString...
  finally
    AppServer.Free;
  end;
end;begin
  FProductID := ParamStr(1);
  FProductPath := Paramstr(2);
  FWindowPath := GetWindowsDir;
  WriteAppserverInfo;
end.help