xboxscene.org forums

Author Topic: [source Code] Free Access To All Storage  (Read 134 times)

Ski-lleR

  • Archived User
  • Jr. Member
  • *
  • Posts: 68
[source Code] Free Access To All Storage
« on: December 19, 2009, 08:55:00 AM »

Hi there

When i starting to develop on 360, the main problem is it's not possible to access the storage freely

You can see with XLaunchNewImage (xex launching) that you are locked in a "virtual drive"

So for those interested in 360 xdk dev, a piece of code, give u access to all the storage hardware (nand, memory unit, sata hdd, removable usb)

CODE
/*
    
    List of physical drive
    
    "\\Device\\Flash"
    "\\Device\\Mu1"
    "\\Device\\Mu0"
    "\\Device\\Cdrom0"
    "\\Device\\Harddisk0\\Partition0"
    "\\Device\\Harddisk0\\Partition1"
    "\\Device\\Harddisk0\\Partition2"
    "\\Device\\Harddisk0\\Partition3"
    "\\Device\\Mass0"
    "\\Device\\Mass1"
    "\\Device\\Mass2"
    
    */
    
    #define DEVICE_NAND_FLASH 0
    #define DEVICE_MEMORY_UNIT0 1
    #define DEVICE_MEMORY_UNIT1 2
    #define DEVICE_CDROM0 3
    #define DEVICE_HARDISK0_PART0 4
    #define DEVICE_HARDISK0_PART1 5
    #define DEVICE_HARDISK0_PART2 6
    #define DEVICE_HARDISK0_PART3 7
    #define DEVICE_USB0 8
    #define DEVICE_USB1 9
    #define DEVICE_USB2 10
    
    typedef struct _STRING {
        USHORT Length;
        USHORT MaximumLength;
        PCHAR Buffer;
    } STRING;
    
    // Follow the white rabbit ^^
    extern "C" int __stdcall ObCreateSymbolicLink( STRING*, STRING*);
    extern "C" int __stdcall ObDeleteSymbolicLink( STRING* );
    
    void Monter( int periphPhys, char* lettreLecteur )
     {
         char lecteurCible[16];
         sprintf_s( lecteurCible,"\\??\\%s", lettreLecteur );
    
         char * periphOriginal;
         switch( periphPhys )
         {
         case DEVICE_NAND_FLASH:
             periphOriginal = "\\Device\\Flash";
         break;
         case DEVICE_MEMORY_UNIT0:
             periphOriginal = "\\Device\\Mu0";
         break;
         case DEVICE_MEMORY_UNIT1:
             periphOriginal = "\\Device\\Mu1";
         break;
         case DEVICE_CDROM0:
             periphOriginal = "\\Device\\Cdrom0";
         break;
         case DEVICE_HARDISK0_PART0:
             periphOriginal = "\\Device\\Harddisk0\\Partition0";
         break;
         case DEVICE_HARDISK0_PART1:
             periphOriginal = "\\Device\\Harddisk0\\Partition1";
         break;
         case DEVICE_HARDISK0_PART2:
             periphOriginal = "\\Device\\Harddisk0\\Partition2";
         break;
         case DEVICE_HARDISK0_PART3:
             periphOriginal = "\\Device\\Harddisk0\\Partition3";
         break;
         case DEVICE_USB0:
             periphOriginal = "\\Device\\Mass0";
         break;
         case DEVICE_USB1:
             periphOriginal = "\\Device\\Mass1";
         break;
         case DEVICE_USB2:
             periphOriginal = "\\Device\\Mass2";
         break;
    
         STRING PeriphOriginal = { strlen( periphOriginal ), strlen( periphOriginal ) + 1, periphOriginal };
         STRING LienSymbolique = { strlen( lecteurCible ), strlen( lecteurCible ) + 1, lecteurCible };
         ObCreateSymbolicLink( &LienSymbolique, &PeriphOriginal );
     }
    
    void Demonter( char* lettreLecteur )
    {
        char lecteurCible[16];
        sprintf_s( lecteurCible,"\\??\\%s", lettreLecteur );
    
        STRING LienSymbolique = { strlen(lecteurCible), strlen(lecteurCible) + 1, lecteurCible };
        ObDeleteSymbolicLink( &LienSymbolique );
    }
    
    // Here, we mount the part containing all major stuff (profile, xbox live game etc...)
    Monter(DEVICE_HARDISK0_PART1, "hdd1:");

    // We test if all working correctly by using the xex launching function
    XLaunchNewImage("hdd1:\\xexalancer.xex", NULL);


Hope that can help people to made good advance in dev
Logged

keine

  • Archived User
  • Full Member
  • *
  • Posts: 190
[source Code] Free Access To All Storage
« Reply #1 on: December 19, 2009, 01:32:00 PM »

WOW!!!!  (IMG:style_emoticons/default/biggrin.gif)
Thanks

This post has been edited by keine: Dec 19 2009, 09:36 PM
Logged

Biaz

  • Archived User
  • Jr. Member
  • *
  • Posts: 89
[source Code] Free Access To All Storage
« Reply #2 on: December 21, 2009, 02:51:00 AM »

Hey guys

I've tried to make this work, but the dash just gives me "Game Error" bla bla bla. I've set it up in VS2005, use the newest XDK, pointed to a valid xex file, it compiles fine but won't work. I tried with a command to make it launch the game library, that works fine. But somehow the code fails.

Could someone send me some source code from a project where this is implemented?

Thanks!
Logged

Biaz

  • Archived User
  • Jr. Member
  • *
  • Posts: 89
[source Code] Free Access To All Storage
« Reply #3 on: December 21, 2009, 03:01:00 AM »

I fixed it biggrin.gif!!

The code i missing a "}" after the last "break;" smile.gif

Thank you very much for this code!
Logged

Ski-lleR

  • Archived User
  • Jr. Member
  • *
  • Posts: 68
[source Code] Free Access To All Storage
« Reply #4 on: December 21, 2009, 03:54:00 AM »

Nice to see it's useful. Yeah, the missing } ^^
Logged

Biaz

  • Archived User
  • Jr. Member
  • *
  • Posts: 89
[source Code] Free Access To All Storage
« Reply #5 on: December 21, 2009, 04:40:00 AM »

I used it to make a small LIVE container that can run games from the original dashboard, just lige you run XeXLoader. Then there is no need to put the game files into the container, just make the container run the default.xex from HDD smile.gif no problem with games > 4GB.
Logged