I've been working on expanding a serverplugin that'll load other 
directories as content directories. (If you've played Garrysmod then I'm 
trying to recreate an addon system.)
I've gotten the interfaces sorted out but I keep hitting this notorious 
(to me at least) exception 'Privileged instruction'. Currently I'm 
trying to mount folders in this structure:
<steam username>\half-life 2 episode two\Addons\<actual folders to mount>

My (relevant) code:

void MountAddon(const char *AddonPath)
{
    filesystem->AddSearchPath(AddonPath, "GAME"); // I'm assuming that 
"GAME" refers to the directory where the hl2.exe file is located
}

I've called it with this test addon/code (the directory exists):

const char test_addon[50] = "CitSkins"; // Citizen Skins

void TestMountAddon()
{
    char buffer[150];
    sprintf(buffer, "Addons\\%s", test_addon);
   
    MountAddon(buffer)
}

I've looked up 'Privileged Instruction' and found this:

'Now Privileged Instruction -

Win32-based applications that call inp(), outp(), and so forth can be 
successfully compiled and linked. However, these applications will 
generate the privileged instruction exception because the port I/O 
functions cannot be called from code running in user mode.

Do not call the following functions from within a Win32-based 
application executing in user mode:

_inp()
_inpw()
_inpd()
_outp()
_outpw()
_outpd()'

Which seems to be in accord with what I've found on MSDN (if with more 
functions that are marked 'privileged').

I'm stumped: Why does calling AddSearchPath cause a privileged 
instruction error? (Perhaps I'm just being stupid and missing the 
obvious right now...)

_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders

Reply via email to