home *** CD-ROM | disk | FTP | other *** search
/ Xentax forum attachments archive / xentax.7z / 5036 / source.7z / x_xbox360.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2012-02-05  |  938 b   |  36 lines

  1. #include "xentax.h"
  2.  
  3. bool XB360Unbundle(const char* exedir, const char* filename, const char* outdir)
  4. {
  5.  using namespace std;
  6.  
  7.  // command line
  8.  string cmdline = "\"";
  9.  cmdline += exedir;
  10.  cmdline += "unbundler.exe";
  11.  cmdline += "\"";
  12.  cmdline += " ";
  13.  cmdline += "\"";
  14.  cmdline += filename;
  15.  cmdline += "\"";
  16.  
  17.  // process startup information
  18.  STARTUPINFOA sinfo;
  19.  ZeroMemory(&sinfo, sizeof(sinfo));
  20.  sinfo.cb = sizeof(sinfo);
  21.  
  22.  // process information
  23.  PROCESS_INFORMATION pinfo;
  24.  ZeroMemory(&pinfo, sizeof(pinfo));
  25.  
  26.  // run xbdecompress
  27.  char buffer[1024];
  28.  memmove(buffer, cmdline.c_str(), cmdline.length() + 1);
  29.  if(!CreateProcessA(NULL, buffer, NULL, NULL, FALSE, NORMAL_PRIORITY_CLASS, NULL, outdir, &sinfo, &pinfo)) return error("Failed to run xbdecompress on XPR file.");
  30.  WaitForSingleObject(pinfo.hProcess, INFINITE);
  31.  CloseHandle(pinfo.hProcess);
  32.  CloseHandle(pinfo.hThread);
  33.  
  34.  return true;
  35. }
  36.