OK guys, get this and get all my points i currently have...
A program runs fine in an IDE under debug, but when you execute it from exporer the just in time debugger kicks in but does not break in ASM. Also it only has a problem when loading a dll.
[Edit Code Snips following]
I have found that when i return an LPCTSTR is when it crashes, still do not understand why it will work when ran from the IDE
Plugin.DLL
LPCTSTR *Initialize()
{
// Initialize plugin
args = new LPCTSTR;
args[BCONNECT] = "Connect"; //Connect button text
args[BDISCONNECT] = "Disconnect"; //Disconnect button text
args[MAP] = "MapDrive";
args[UNMAP] = "UnMapDrive";
args[DOMAIN] = "DOMAIN";
// Drive letter and server, 2 slots per network drive
int NumOfDrives = 1; //The number of network drives
Drives = new LPCTSTR;
Drives[0] = "Z:"; //Drive letter to use
Drives[1] = "localhost"; //Server to use
Drives[2] = "127.0.0.1"; //Fallback IP
// Add drives and servers to main array
for(int i = 0; i <= NumOfDrives*3-1; i++)
{
args[DRIVES+i] = Drives[i];
args[DRIVES+i+1] = NULL;
}
return args;
}
Program.exe
typedef LPCTSTR *(*Initialize)(void);
Initialize Init = (Initialize)::GetProcAddress(PlugDll,"Initialize");
if(!Init)
{
MessageBox("Failed to initialize",0, MB_ICONERROR);
break;
}
// Setup local vars
DriveArgs = NULL;
DriveArgs = new LPCTSTR;
// Call initialize function
break;
DriveArgs = Init();
Now if i break before i call the dll function my program wont crash so i know it is that function on the dll. could it be the returning of the LPCTSTR *args?
Then you assign values to the array elements.
But I don't see any dimension for the LPCTSTR ??
I suspect you need to allocate some real memory for the elements.