mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-05 17:09:37 +00:00
Added -dll option for winelib programs. (Note: will not print warnings
on failure currently).
This commit is contained in:
parent
e49700acf9
commit
461ded42ac
|
@ -351,15 +351,20 @@ void BUILTIN_DefaultIntHandler( CONTEXT *context )
|
|||
*
|
||||
* Set runtime DLL usage flags
|
||||
*/
|
||||
BOOL BUILTIN_ParseDLLOptions( const char *str )
|
||||
BOOL BUILTIN_ParseDLLOptions( char *str )
|
||||
{
|
||||
BUILTIN16_DLL *dll;
|
||||
const char *p;
|
||||
char *p,*last;
|
||||
|
||||
|
||||
last = str;
|
||||
while (*str)
|
||||
{
|
||||
while (*str && isspace(*str)) str++;
|
||||
if (!*str) return TRUE;
|
||||
while (*str && (*str==',' || isspace(*str))) str++;
|
||||
if (!*str) {
|
||||
*last = '\0'; /* cut off garbage at end at */
|
||||
return TRUE;
|
||||
}
|
||||
if ((*str != '+') && (*str != '-')) return FALSE;
|
||||
str++;
|
||||
if (!(p = strchr( str, ',' ))) p = str + strlen(str);
|
||||
|
@ -380,11 +385,22 @@ BOOL BUILTIN_ParseDLLOptions( const char *str )
|
|||
break;
|
||||
}
|
||||
}
|
||||
if (!dll->descr)
|
||||
if (!BUILTIN32_EnableDLL( str, (int)(p - str), (str[-1] == '+') ))
|
||||
return FALSE;
|
||||
str = p;
|
||||
while (*str && (isspace(*str) || (*str == ','))) str++;
|
||||
if (!dll->descr) {
|
||||
/* not found, but could get handled by BUILTIN32_, so move last */
|
||||
last = p;
|
||||
str = p;
|
||||
} else {
|
||||
/* handled. cut out the "[+-]DLL," string, so it isn't handled
|
||||
* by BUILTIN32
|
||||
*/
|
||||
if (*p) {
|
||||
memcpy(last,p,strlen(p)+1);
|
||||
str = last;
|
||||
} else {
|
||||
*last = '\0';
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -199,11 +199,12 @@ HGLOBAL16 NE_LoadPEResource( NE_MODULE *pModule, WORD type, LPVOID bits, DWORD s
|
|||
extern BOOL BUILTIN_Init(void);
|
||||
extern HMODULE16 BUILTIN_LoadModule( LPCSTR name, BOOL force );
|
||||
extern LPCSTR BUILTIN_GetEntryPoint16( WORD cs, WORD ip, WORD *pOrd );
|
||||
extern BOOL BUILTIN_ParseDLLOptions( const char *str );
|
||||
extern BOOL BUILTIN_ParseDLLOptions( char *str );
|
||||
extern void BUILTIN_PrintDLLs(void);
|
||||
|
||||
/* relay32/builtin.c */
|
||||
extern HMODULE BUILTIN32_LoadImage( LPCSTR name, OFSTRUCT *ofs, BOOL force );
|
||||
extern BOOL BUILTIN32_ParseDLLOptions( char *str );
|
||||
|
||||
/* if1632/builtin.c */
|
||||
extern HMODULE16 (*fnBUILTIN_LoadModule)(LPCSTR name, BOOL force);
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include "debug.h"
|
||||
#include "debugdefs.h"
|
||||
#include "xmalloc.h"
|
||||
#include "module.h"
|
||||
#include "version.h"
|
||||
#include "winnls.h"
|
||||
#include "console.h"
|
||||
|
@ -816,6 +817,10 @@ BOOL MAIN_WineInit( int *argc, char *argv[] )
|
|||
#endif /* !defined(X_DISPLAY_MISSING) */
|
||||
MONITOR_Initialize(&MONITOR_PrimaryMonitor);
|
||||
|
||||
if (Options.dllFlags)
|
||||
BUILTIN32_ParseDLLOptions( Options.dllFlags );
|
||||
/* if (__winelib && errors ) print_error_message_like_misc_main(); */
|
||||
|
||||
atexit(called_at_exit);
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -140,8 +140,8 @@ int main( int argc, char *argv[] )
|
|||
/* Handle -dll option (hack) */
|
||||
if (Options.dllFlags)
|
||||
{
|
||||
if (!BUILTIN_ParseDLLOptions( Options.dllFlags ))
|
||||
{
|
||||
/* If there are options left, or if the parser had errors, report it */
|
||||
if (!BUILTIN_ParseDLLOptions( Options.dllFlags )||Options.dllFlags[0]) {
|
||||
MSG("%s: Syntax: -dll +xxx,... or -dll -xxx,...\n",
|
||||
argv[0] );
|
||||
BUILTIN_PrintDLLs();
|
||||
|
|
|
@ -435,29 +435,61 @@ void BUILTIN32_Unimplemented( const BUILTIN32_DESCRIPTOR *descr, int ordinal )
|
|||
ExitProcess(1);
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* BUILTIN32_EnableDLL
|
||||
* BUILTIN32_ParseDLLOptions
|
||||
*
|
||||
* Enable or disable a built-in DLL.
|
||||
* Set runtime DLL usage flags
|
||||
*/
|
||||
int BUILTIN32_EnableDLL( const char *name, int len, int enable )
|
||||
BOOL BUILTIN32_ParseDLLOptions( char *str )
|
||||
{
|
||||
int i;
|
||||
BUILTIN32_DLL *dll;
|
||||
char *p,*last;
|
||||
|
||||
for (i = 0, dll = BuiltinDLLs; dll->descr; dll++)
|
||||
last = str;
|
||||
while (*str)
|
||||
{
|
||||
if (!lstrncmpiA( name, dll->descr->name, len ))
|
||||
{
|
||||
dll->used = enable;
|
||||
return TRUE;
|
||||
}
|
||||
while (*str && (*str==',' || isspace(*str))) str++;
|
||||
if (!*str) {
|
||||
*last = '\0'; /* cut off garbage at end at */
|
||||
return TRUE;
|
||||
}
|
||||
if ((*str != '+') && (*str != '-')) return FALSE;
|
||||
str++;
|
||||
if (!(p = strchr( str, ',' ))) p = str + strlen(str);
|
||||
while ((p > str) && isspace(p[-1])) p--;
|
||||
if (p == str) return FALSE;
|
||||
for (dll = BuiltinDLLs; dll->descr; dll++)
|
||||
{
|
||||
if (!lstrncmpiA( dll->descr->name, str, (int)(p-str) ))
|
||||
{
|
||||
if (dll->descr->name[p-str]) /* partial match - skip */
|
||||
continue;
|
||||
dll->used = (str[-1]!='-');
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!dll->descr) {
|
||||
/* not found, but could get handled by BUILTIN_, so move last */
|
||||
last = p;
|
||||
str = p;
|
||||
} else {
|
||||
/* handled. cut out the "[+-]DLL," string, so it isn't handled
|
||||
* by BUILTIN
|
||||
*/
|
||||
if (*p) {
|
||||
memcpy(last,p,strlen(p)+1);
|
||||
str = last;
|
||||
} else {
|
||||
*last = '\0';
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* BUILTIN32_PrintDLLs
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue