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

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