mirror of
https://github.com/reactos/reactos.git
synced 2025-02-20 15:35:04 +00:00
- Add small checking
- Fix formating svn path=/trunk/; revision=32389
This commit is contained in:
parent
a8bcd72318
commit
c066249bd7
20 changed files with 347 additions and 377 deletions
|
@ -1,12 +1,8 @@
|
|||
#include "resource.h"
|
||||
/*
|
||||
* Moved all hardcoded strings to En.rc.
|
||||
* By Magnus Olsen 2005 magnus@itkonsult-olsen.com
|
||||
*/
|
||||
|
||||
LANGUAGE LANG_BULGARIAN, SUBLANG_DEFAULT
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
IDS_DllNotLoaded, "Íåóñïåøíî çàðåæäàíå íà áèáëèîòåêà '%s'"
|
||||
IDS_MissingEntry, "Ëèïñâàùà âõîäíà òî÷êà:%s\nâ %s"
|
||||
IDS_DllNotLoaded, "Неуспешно зареждане на библиотека '%s'"
|
||||
IDS_MissingEntry, "Липсваща входна точка:%s\nв %s"
|
||||
END
|
||||
|
|
|
@ -7,6 +7,6 @@
|
|||
LANGUAGE LANG_GERMAN, SUBLANG_NEUTRAL
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
IDS_DllNotLoaded, "LoadLibrary laden von '%s' fehlgeschlagen"
|
||||
IDS_MissingEntry, "Fehlender Eintrag:%s\nIn %s"
|
||||
IDS_DllNotLoaded, "LoadLibrary laden von '%s' fehlgeschlagen"
|
||||
IDS_MissingEntry, "Fehlender Eintrag:%s\nIn %s"
|
||||
END
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
#include "resource.h"
|
||||
/*
|
||||
* Moved all hardcoded strings to En.rc.
|
||||
* By Magnus Olsen 2005 magnus@itkonsult-olsen.com
|
||||
* Gr.rc by Dj Apal®
|
||||
*/
|
||||
|
||||
LANGUAGE LANG_GREEK, SUBLANG_DEFAULT
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
IDS_DllNotLoaded, "LoadLibrary äåí êáôÜöåñå íá öïñôþóåé '%s'"
|
||||
IDS_MissingEntry, "Ëåßðåé ôï óçìåßï åêêßíçóçò:%s\nIn %s"
|
||||
IDS_DllNotLoaded, "LoadLibrary δεν κατάφερε να φορτώσει '%s'"
|
||||
IDS_MissingEntry, "Λείπει το σημείο εκκίνησης:%s\nIn %s"
|
||||
END
|
||||
|
|
|
@ -7,6 +7,6 @@
|
|||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
IDS_DllNotLoaded, "LoadLibrary failed to load '%s'"
|
||||
IDS_MissingEntry, "Missing entry point:%s\nIn %s"
|
||||
IDS_DllNotLoaded, "LoadLibrary failed to load '%s'"
|
||||
IDS_MissingEntry, "Missing entry point:%s\nIn %s"
|
||||
END
|
||||
|
|
|
@ -1,12 +1,8 @@
|
|||
#include "resource.h"
|
||||
/*
|
||||
* Moved all hardcoded strings to En.rc.
|
||||
* By Magnus Olsen 2005 magnus@itkonsult-olsen.com
|
||||
*/
|
||||
|
||||
LANGUAGE LANG_SPANISH, SUBLANG_NEUTRAL
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
IDS_DllNotLoaded, "El cargador de Librerias falló al cargar '%s'"
|
||||
IDS_MissingEntry, "Punto de entrada perdido:%s\nIn %s"
|
||||
IDS_DllNotLoaded, "El cargador de Librerias falló al cargar '%s'"
|
||||
IDS_MissingEntry, "Punto de entrada perdido:%s\nIn %s"
|
||||
END
|
||||
|
|
|
@ -1,12 +1,8 @@
|
|||
#include "resource.h"
|
||||
/*
|
||||
* Moved all hardcoded strings to En.rc.
|
||||
* By Magnus Olsen 2005 magnus@itkonsult-olsen.com
|
||||
*/
|
||||
|
||||
LANGUAGE LANG_FRENCH, SUBLANG_NEUTRAL
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
IDS_DllNotLoaded, "LoadLibrary a échoué lors du chargement de '%s'"
|
||||
IDS_MissingEntry, "Point d'entrée manquant:%s\ndans %s"
|
||||
IDS_DllNotLoaded, "LoadLibrary a échoué lors du chargement de '%s'"
|
||||
IDS_MissingEntry, "Point d'entrée manquant:%s\ndans %s"
|
||||
END
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
#include "resource.h"
|
||||
/*
|
||||
* Moved all hardcoded strings to En.rc.
|
||||
* By Magnus Olsen 2005 magnus@itkonsult-olsen.com
|
||||
* Hungarian version is Copyright 2005 - Peter Nagy <nagylakas@gmail.com>
|
||||
*/
|
||||
|
||||
LANGUAGE LANG_HUNGARIAN, SUBLANG_DEFAULT
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
IDS_DllNotLoaded, "A(z) '%s' állományt, vagy valamelyik összetevőjét nem sikerült megnyitni"
|
||||
IDS_MissingEntry, "Hiányzó bejegyzés: %s\nIn A Következő állomány nem tölthető be: %s"
|
||||
IDS_DllNotLoaded, "A(z) '%s' állományt, vagy valamelyik összetevőjét nem sikerült megnyitni"
|
||||
IDS_MissingEntry, "Hiányzó bejegyzés: %s\nIn A Következő állomány nem tölthető be: %s"
|
||||
END
|
||||
|
|
|
@ -4,6 +4,6 @@ LANGUAGE LANG_INDONESIAN, SUBLANG_DEFAULT
|
|||
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
IDS_DllNotLoaded, "LoadLibrary gagal untuk mengambil '%s'"
|
||||
IDS_MissingEntry, "entry point hilang:%s\nDalam %s"
|
||||
IDS_DllNotLoaded, "LoadLibrary gagal untuk mengambil '%s'"
|
||||
IDS_MissingEntry, "entry point hilang:%s\nDalam %s"
|
||||
END
|
||||
|
|
|
@ -1,12 +1,8 @@
|
|||
#include "resource.h"
|
||||
/*
|
||||
* Moved all hardcoded strings to En.rc.
|
||||
* By Magnus Olsen 2005 magnus@itkonsult-olsen.com
|
||||
*/
|
||||
|
||||
LANGUAGE LANG_ITALIAN, SUBLANG_NEUTRAL
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
IDS_DllNotLoaded, "LoadLibrary fallita '%s'"
|
||||
IDS_MissingEntry, "Manca:%s\nIn %s"
|
||||
IDS_DllNotLoaded, "LoadLibrary fallita '%s'"
|
||||
IDS_MissingEntry, "Manca:%s\nIn %s"
|
||||
END
|
||||
|
|
|
@ -1,12 +1,8 @@
|
|||
#include "resource.h"
|
||||
/*
|
||||
* Moved all hardcoded strings to En.rc.
|
||||
* By Magnus Olsen 2005 magnus@itkonsult-olsen.com
|
||||
*/
|
||||
|
||||
LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
IDS_DllNotLoaded, "LoadLibrary は '%s' の読み込みに失敗しました。"
|
||||
IDS_MissingEntry, "エントリ ポイントがありません:%s\n( %s 中)"
|
||||
IDS_DllNotLoaded, "LoadLibrary は '%s' の読み込みに失敗しました。"
|
||||
IDS_MissingEntry, "エントリ ポイントがありません:%s\n( %s 中)"
|
||||
END
|
||||
|
|
|
@ -5,6 +5,6 @@
|
|||
LANGUAGE LANG_LITHUANIAN, SUBLANG_DEFAULT
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
IDS_DllNotLoaded, "LoadLibrary nepavyko paleisti '%s'"
|
||||
IDS_MissingEntry, "Trûksta áëjimo taðko:%s\nIn %s"
|
||||
IDS_DllNotLoaded, "LoadLibrary nepavyko paleisti '%s'"
|
||||
IDS_MissingEntry, "Trûksta áëjimo taðko:%s\nIn %s"
|
||||
END
|
||||
|
|
|
@ -1,12 +1,8 @@
|
|||
#include "resource.h"
|
||||
/*
|
||||
* Moved all hardcoded strings to En.rc.
|
||||
* By Magnus Olsen 2005 magnus@itkonsult-olsen.com
|
||||
*/
|
||||
|
||||
LANGUAGE LANG_NORWEGIAN, SUBLANG_NEUTRAL
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
IDS_DllNotLoaded, "LoadLibrary mislykket å laste '%s'"
|
||||
IDS_MissingEntry, "Mistet oppføring moment:%s\nIn %s"
|
||||
IDS_DllNotLoaded, "LoadLibrary mislykket å laste '%s'"
|
||||
IDS_MissingEntry, "Mistet oppføring moment:%s\nIn %s"
|
||||
END
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
#include "resource.h"
|
||||
/*
|
||||
* Moved all hardcoded strings to En.rc.
|
||||
* By Magnus Olsen 2005 magnus@itkonsult-olsen.com
|
||||
* Translation done by Vertaald door Eric Janssen
|
||||
*/
|
||||
|
||||
LANGUAGE LANG_DUTCH, SUBLANG_NEUTRAL
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
IDS_DllNotLoaded, "LoadLibrary kon '%s' niet laden"
|
||||
IDS_MissingEntry, "Entry point:%s\n niet gevonden In %s"
|
||||
IDS_DllNotLoaded, "LoadLibrary kon '%s' niet laden"
|
||||
IDS_MissingEntry, "Entry point:%s\n niet gevonden In %s"
|
||||
END
|
||||
|
|
|
@ -8,6 +8,6 @@
|
|||
LANGUAGE LANG_POLISH, SUBLANG_DEFAULT
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
IDS_DllNotLoaded, "LoadLibrary nie mógł załadować '%s'"
|
||||
IDS_MissingEntry, "Brakujący punkt wejścia:%s\nW %s"
|
||||
IDS_DllNotLoaded, "LoadLibrary nie mógł załadować '%s'"
|
||||
IDS_MissingEntry, "Brakujący punkt wejścia:%s\nW %s"
|
||||
END
|
||||
|
|
|
@ -1,12 +1,8 @@
|
|||
#include "resource.h"
|
||||
/*
|
||||
* Moved all hardcoded strings to En.rc.
|
||||
* By Magnus Olsen 2005 magnus@itkonsult-olsen.com
|
||||
*/
|
||||
|
||||
LANGUAGE LANG_PORTUGUESE, SUBLANG_NEUTRAL
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
IDS_DllNotLoaded, "Erro ao carregar '%s'"
|
||||
IDS_MissingEntry, "Está faltando a entrada:%s\nem %s"
|
||||
IDS_DllNotLoaded, "Erro ao carregar '%s'"
|
||||
IDS_MissingEntry, "Está faltando a entrada:%s\nem %s"
|
||||
END
|
||||
|
|
|
@ -1,12 +1,8 @@
|
|||
#include "resource.h"
|
||||
/*
|
||||
* Moved all hardcoded strings to En.rc.
|
||||
* By Magnus Olsen 2005 magnus@itkonsult-olsen.com
|
||||
*/
|
||||
|
||||
LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
IDS_DllNotLoaded, "Íåâîçìîæíî çàãðóçèòü áèáëèîòåêó '%s'"
|
||||
IDS_MissingEntry, "Íåâîçìîæíî íàéòè òî÷êó âõîäà: %s\nâ áèáëèîòåêå %s"
|
||||
IDS_DllNotLoaded, "Невозможно загрузить библиотеку '%s'"
|
||||
IDS_MissingEntry, "Невозможно найти точку входа: %s\nв библиотеке %s"
|
||||
END
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
#include "resource.h"
|
||||
/*
|
||||
* Moved all hardcoded strings to En.rc.
|
||||
* By Magnus Olsen 2005 magnus@itkonsult-olsen.com
|
||||
* Slovak translation by Kario 2007 <kario@szm.sk>
|
||||
*/
|
||||
|
||||
LANGUAGE LANG_SLOVAK, SUBLANG_DEFAULT
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
IDS_DllNotLoaded, "Naèítanie knižnice zlyhalo pri pokus naèíta<74> '%s'"
|
||||
IDS_MissingEntry, "Chybný vstupný bod:%s\nv %s"
|
||||
IDS_DllNotLoaded, "Načítanie knižnice zlyhalo pri pokus načítať '%s'"
|
||||
IDS_MissingEntry, "Chybný vstupný bod:%s\nv %s"
|
||||
END
|
||||
|
|
|
@ -9,6 +9,6 @@
|
|||
LANGUAGE LANG_THAI, SUBLANG_DEFAULT
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
IDS_DllNotLoaded, "∫煤妹ㄘよ颐泻亨≡醇源九掖 '%s'"
|
||||
IDS_MissingEntry, "∫绵㈤宜业俞斯瑙荚淳乓<E6B7B3>: %s\n%s"
|
||||
IDS_DllNotLoaded, "∫煤妹ㄘよ颐泻亨≡醇源九掖 '%s'"
|
||||
IDS_MissingEntry, "∫绵㈤宜业俞斯瑙荚淳乓<E6B7B3>: %s\n%s"
|
||||
END
|
||||
|
|
|
@ -12,6 +12,6 @@ LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT
|
|||
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
IDS_DllNotLoaded, "LoadLibrary не вдалося завантажити '%s'"
|
||||
IDS_MissingEntry, "Неможливо знайти точку входу:%s\nВ бібліотеці %s"
|
||||
IDS_DllNotLoaded, "LoadLibrary не вдалося завантажити '%s'"
|
||||
IDS_MissingEntry, "Неможливо знайти точку входу:%s\nВ бібліотеці %s"
|
||||
END
|
||||
|
|
|
@ -60,176 +60,176 @@ LPTSTR ModuleTitle;
|
|||
// and is not intended to be used in any other program.
|
||||
LPTSTR *WINAPI CommandLineToArgv(LPCTSTR lpCmdLine, int *lpArgc)
|
||||
{
|
||||
LPTSTR *argv, lpSrc, lpDest, lpArg;
|
||||
int argc, nBSlash, nNames;
|
||||
BOOL bInQuotes, bFirstChar;
|
||||
LPTSTR *argv, lpSrc, lpDest, lpArg;
|
||||
int argc, nBSlash, nNames;
|
||||
BOOL bInQuotes, bFirstChar;
|
||||
|
||||
// If null was passed in for lpCmdLine, there are no arguments
|
||||
if (!lpCmdLine) {
|
||||
if (lpArgc)
|
||||
*lpArgc = 0;
|
||||
return 0;
|
||||
}
|
||||
// If null was passed in for lpCmdLine, there are no arguments
|
||||
if (!lpCmdLine) {
|
||||
if (lpArgc)
|
||||
*lpArgc = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
lpSrc = (LPTSTR)lpCmdLine;
|
||||
// Skip spaces at beginning
|
||||
while (*lpSrc == _T(' ') || *lpSrc == _T('\t'))
|
||||
lpSrc++;
|
||||
lpSrc = (LPTSTR)lpCmdLine;
|
||||
// Skip spaces at beginning
|
||||
while (*lpSrc == _T(' ') || *lpSrc == _T('\t'))
|
||||
lpSrc++;
|
||||
|
||||
// If command-line starts with null, there are no arguments
|
||||
if (*lpSrc == 0) {
|
||||
if (lpArgc)
|
||||
*lpArgc = 0;
|
||||
return 0;
|
||||
}
|
||||
// If command-line starts with null, there are no arguments
|
||||
if (*lpSrc == 0) {
|
||||
if (lpArgc)
|
||||
*lpArgc = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
lpArg = lpSrc;
|
||||
argc = 0;
|
||||
nBSlash = 0;
|
||||
bInQuotes = FALSE;
|
||||
bFirstChar = TRUE;
|
||||
nNames = 0;
|
||||
lpArg = lpSrc;
|
||||
argc = 0;
|
||||
nBSlash = 0;
|
||||
bInQuotes = FALSE;
|
||||
bFirstChar = TRUE;
|
||||
nNames = 0;
|
||||
|
||||
// Count the number of arguments
|
||||
while (nNames < 4) {
|
||||
if (*lpSrc == 0 || (*lpSrc == _T(',') && nNames == 2) || ((*lpSrc == _T(' ') || *lpSrc == _T('\t')) && !bInQuotes)) {
|
||||
// Whitespace not enclosed in quotes signals the start of another argument
|
||||
argc++;
|
||||
// Count the number of arguments
|
||||
while (nNames < 4) {
|
||||
if (*lpSrc == 0 || (*lpSrc == _T(',') && nNames == 2) || ((*lpSrc == _T(' ') || *lpSrc == _T('\t')) && !bInQuotes)) {
|
||||
// Whitespace not enclosed in quotes signals the start of another argument
|
||||
argc++;
|
||||
|
||||
// Skip whitespace between arguments
|
||||
while (*lpSrc == _T(' ') || *lpSrc == _T('\t') || (*lpSrc == _T(',') && nNames == 2))
|
||||
lpSrc++;
|
||||
if (*lpSrc == 0)
|
||||
break;
|
||||
if (nNames >= 3) {
|
||||
// Increment the count for the last argument
|
||||
argc++;
|
||||
break;
|
||||
}
|
||||
nBSlash = 0;
|
||||
bFirstChar = TRUE;
|
||||
continue;
|
||||
}
|
||||
else if (*lpSrc == _T('\\')) {
|
||||
// Count consecutive backslashes
|
||||
nBSlash++;
|
||||
bFirstChar = FALSE;
|
||||
}
|
||||
else if (*lpSrc == _T('\"') && !(nBSlash & 1)) {
|
||||
// Open or close quotes
|
||||
bInQuotes = !bInQuotes;
|
||||
nBSlash = 0;
|
||||
}
|
||||
else {
|
||||
// Some other character
|
||||
nBSlash = 0;
|
||||
if (bFirstChar && ((*lpSrc != _T('/') && nNames <= 1) || nNames > 1))
|
||||
nNames++;
|
||||
bFirstChar = FALSE;
|
||||
}
|
||||
lpSrc++;
|
||||
}
|
||||
// Skip whitespace between arguments
|
||||
while (*lpSrc == _T(' ') || *lpSrc == _T('\t') || (*lpSrc == _T(',') && nNames == 2))
|
||||
lpSrc++;
|
||||
if (*lpSrc == 0)
|
||||
break;
|
||||
if (nNames >= 3) {
|
||||
// Increment the count for the last argument
|
||||
argc++;
|
||||
break;
|
||||
}
|
||||
nBSlash = 0;
|
||||
bFirstChar = TRUE;
|
||||
continue;
|
||||
}
|
||||
else if (*lpSrc == _T('\\')) {
|
||||
// Count consecutive backslashes
|
||||
nBSlash++;
|
||||
bFirstChar = FALSE;
|
||||
}
|
||||
else if (*lpSrc == _T('\"') && !(nBSlash & 1)) {
|
||||
// Open or close quotes
|
||||
bInQuotes = !bInQuotes;
|
||||
nBSlash = 0;
|
||||
}
|
||||
else {
|
||||
// Some other character
|
||||
nBSlash = 0;
|
||||
if (bFirstChar && ((*lpSrc != _T('/') && nNames <= 1) || nNames > 1))
|
||||
nNames++;
|
||||
bFirstChar = FALSE;
|
||||
}
|
||||
lpSrc++;
|
||||
}
|
||||
|
||||
// Allocate space for the pointers in argv and the strings in one block
|
||||
argv = (LPTSTR *)malloc(argc * sizeof(LPTSTR) + (_tcslen(lpArg) + 1) * sizeof(TCHAR));
|
||||
// Allocate space for the pointers in argv and the strings in one block
|
||||
argv = (LPTSTR *)malloc(argc * sizeof(LPTSTR) + (_tcslen(lpArg) + 1) * sizeof(TCHAR));
|
||||
|
||||
if (!argv) {
|
||||
// Memory allocation failed
|
||||
if (lpArgc)
|
||||
*lpArgc = 0;
|
||||
return 0;
|
||||
}
|
||||
if (!argv) {
|
||||
// Memory allocation failed
|
||||
if (lpArgc)
|
||||
*lpArgc = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
lpSrc = lpArg;
|
||||
lpDest = lpArg = (LPTSTR)(argv + argc);
|
||||
argc = 0;
|
||||
nBSlash = 0;
|
||||
bInQuotes = FALSE;
|
||||
bFirstChar = TRUE;
|
||||
nNames = 0;
|
||||
lpSrc = lpArg;
|
||||
lpDest = lpArg = (LPTSTR)(argv + argc);
|
||||
argc = 0;
|
||||
nBSlash = 0;
|
||||
bInQuotes = FALSE;
|
||||
bFirstChar = TRUE;
|
||||
nNames = 0;
|
||||
|
||||
// Fill the argument array
|
||||
while (nNames < 4) {
|
||||
if (*lpSrc == 0 || (*lpSrc == _T(',') && nNames == 2) || ((*lpSrc == _T(' ') || *lpSrc == _T('\t')) && !bInQuotes)) {
|
||||
// Whitespace not enclosed in quotes signals the start of another argument
|
||||
// Null-terminate argument
|
||||
*lpDest++ = 0;
|
||||
argv[argc++] = lpArg;
|
||||
// Fill the argument array
|
||||
while (nNames < 4) {
|
||||
if (*lpSrc == 0 || (*lpSrc == _T(',') && nNames == 2) || ((*lpSrc == _T(' ') || *lpSrc == _T('\t')) && !bInQuotes)) {
|
||||
// Whitespace not enclosed in quotes signals the start of another argument
|
||||
// Null-terminate argument
|
||||
*lpDest++ = 0;
|
||||
argv[argc++] = lpArg;
|
||||
|
||||
// Skip whitespace between arguments
|
||||
while (*lpSrc == _T(' ') || *lpSrc == _T('\t') || (*lpSrc == _T(',') && nNames == 2))
|
||||
lpSrc++;
|
||||
if (*lpSrc == 0)
|
||||
break;
|
||||
lpArg = lpDest;
|
||||
if (nNames >= 3) {
|
||||
// Copy the rest of the command-line to the last argument
|
||||
argv[argc++] = lpArg;
|
||||
_tcscpy(lpArg,lpSrc);
|
||||
break;
|
||||
}
|
||||
nBSlash = 0;
|
||||
bFirstChar = TRUE;
|
||||
continue;
|
||||
}
|
||||
else if (*lpSrc == _T('\\')) {
|
||||
*lpDest++ = _T('\\');
|
||||
lpSrc++;
|
||||
// Skip whitespace between arguments
|
||||
while (*lpSrc == _T(' ') || *lpSrc == _T('\t') || (*lpSrc == _T(',') && nNames == 2))
|
||||
lpSrc++;
|
||||
if (*lpSrc == 0)
|
||||
break;
|
||||
lpArg = lpDest;
|
||||
if (nNames >= 3) {
|
||||
// Copy the rest of the command-line to the last argument
|
||||
argv[argc++] = lpArg;
|
||||
_tcscpy(lpArg,lpSrc);
|
||||
break;
|
||||
}
|
||||
nBSlash = 0;
|
||||
bFirstChar = TRUE;
|
||||
continue;
|
||||
}
|
||||
else if (*lpSrc == _T('\\')) {
|
||||
*lpDest++ = _T('\\');
|
||||
lpSrc++;
|
||||
|
||||
// Count consecutive backslashes
|
||||
nBSlash++;
|
||||
bFirstChar = FALSE;
|
||||
}
|
||||
else if (*lpSrc == _T('\"')) {
|
||||
if (!(nBSlash & 1)) {
|
||||
// If an even number of backslashes are before the quotes,
|
||||
// the quotes don't go in the output
|
||||
lpDest -= nBSlash / 2;
|
||||
bInQuotes = !bInQuotes;
|
||||
}
|
||||
else {
|
||||
// If an odd number of backslashes are before the quotes,
|
||||
// output a quote
|
||||
lpDest -= (nBSlash + 1) / 2;
|
||||
*lpDest++ = _T('\"');
|
||||
bFirstChar = FALSE;
|
||||
}
|
||||
lpSrc++;
|
||||
nBSlash = 0;
|
||||
}
|
||||
else {
|
||||
// Copy other characters
|
||||
if (bFirstChar && ((*lpSrc != _T('/') && nNames <= 1) || nNames > 1))
|
||||
nNames++;
|
||||
*lpDest++ = *lpSrc++;
|
||||
nBSlash = 0;
|
||||
bFirstChar = FALSE;
|
||||
}
|
||||
}
|
||||
// Count consecutive backslashes
|
||||
nBSlash++;
|
||||
bFirstChar = FALSE;
|
||||
}
|
||||
else if (*lpSrc == _T('\"')) {
|
||||
if (!(nBSlash & 1)) {
|
||||
// If an even number of backslashes are before the quotes,
|
||||
// the quotes don't go in the output
|
||||
lpDest -= nBSlash / 2;
|
||||
bInQuotes = !bInQuotes;
|
||||
}
|
||||
else {
|
||||
// If an odd number of backslashes are before the quotes,
|
||||
// output a quote
|
||||
lpDest -= (nBSlash + 1) / 2;
|
||||
*lpDest++ = _T('\"');
|
||||
bFirstChar = FALSE;
|
||||
}
|
||||
lpSrc++;
|
||||
nBSlash = 0;
|
||||
}
|
||||
else {
|
||||
// Copy other characters
|
||||
if (bFirstChar && ((*lpSrc != _T('/') && nNames <= 1) || nNames > 1))
|
||||
nNames++;
|
||||
*lpDest++ = *lpSrc++;
|
||||
nBSlash = 0;
|
||||
bFirstChar = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if (lpArgc)
|
||||
*lpArgc = argc;
|
||||
return argv;
|
||||
if (lpArgc)
|
||||
*lpArgc = argc;
|
||||
return argv;
|
||||
}
|
||||
|
||||
void GetModuleTitle(void)
|
||||
{
|
||||
LPTSTR lpStr;
|
||||
LPTSTR lpStr;
|
||||
|
||||
GetModuleFileName(0,ModuleFileName,MAX_PATH);
|
||||
ModuleTitle = ModuleFileName;
|
||||
GetModuleFileName(0,ModuleFileName,MAX_PATH);
|
||||
ModuleTitle = ModuleFileName;
|
||||
|
||||
for (lpStr = ModuleFileName;*lpStr;lpStr++) {
|
||||
if (*lpStr == _T('\\'))
|
||||
ModuleTitle = lpStr+1;
|
||||
}
|
||||
for (lpStr = ModuleFileName;*lpStr;lpStr++) {
|
||||
if (*lpStr == _T('\\'))
|
||||
ModuleTitle = lpStr+1;
|
||||
}
|
||||
|
||||
for (lpStr = ModuleTitle;*lpStr;lpStr++) {
|
||||
if (_tcsicmp(lpStr,_T(".exe"))==0)
|
||||
break;
|
||||
}
|
||||
for (lpStr = ModuleTitle;*lpStr;lpStr++) {
|
||||
if (_tcsicmp(lpStr,_T(".exe"))==0)
|
||||
break;
|
||||
}
|
||||
|
||||
*lpStr = 0;
|
||||
*lpStr = 0;
|
||||
}
|
||||
|
||||
// The macro ConvertToWideChar takes a tstring parameter and returns
|
||||
|
@ -245,15 +245,15 @@ void GetModuleTitle(void)
|
|||
|
||||
LPWSTR ConvertToWideChar(LPCSTR lpString)
|
||||
{
|
||||
LPWSTR lpwString;
|
||||
size_t nStrLen;
|
||||
LPWSTR lpwString;
|
||||
size_t nStrLen;
|
||||
|
||||
nStrLen = strlen(lpString) + 1;
|
||||
nStrLen = strlen(lpString) + 1;
|
||||
|
||||
lpwString = (LPWSTR)malloc(nStrLen * sizeof(WCHAR));
|
||||
MultiByteToWideChar(0,0,lpString,nStrLen,lpwString,nStrLen);
|
||||
lpwString = (LPWSTR)malloc(nStrLen * sizeof(WCHAR));
|
||||
MultiByteToWideChar(0,0,lpString,nStrLen,lpwString,nStrLen);
|
||||
|
||||
return lpwString;
|
||||
return lpwString;
|
||||
}
|
||||
|
||||
#define FreeConvertedWideChar(lpwString) free(lpwString)
|
||||
|
@ -281,47 +281,54 @@ LPWSTR ConvertToWideChar(LPCSTR lpString)
|
|||
// for the returned string when it is no longer needed.
|
||||
LPSTR DuplicateToMultiByte(LPCTSTR lptString, size_t nBufferSize)
|
||||
{
|
||||
LPSTR lpString;
|
||||
size_t nStrLen;
|
||||
LPSTR lpString;
|
||||
size_t nStrLen;
|
||||
|
||||
nStrLen = _tcslen(lptString) + 1;
|
||||
if (nBufferSize == 0) nBufferSize = nStrLen;
|
||||
nStrLen = _tcslen(lptString) + 1;
|
||||
if (nBufferSize == 0) nBufferSize = nStrLen;
|
||||
|
||||
lpString = (LPSTR)malloc(nBufferSize);
|
||||
lpString = (LPSTR)malloc(nBufferSize);
|
||||
#ifdef UNICODE
|
||||
WideCharToMultiByte(0,0,lptString,nStrLen,lpString,nBufferSize,0,0);
|
||||
WideCharToMultiByte(0,0,lptString,nStrLen,lpString,nBufferSize,0,0);
|
||||
#else
|
||||
strncpy(lpString,lptString,nBufferSize);
|
||||
strncpy(lpString,lptString,nBufferSize);
|
||||
#endif
|
||||
|
||||
return lpString;
|
||||
return lpString;
|
||||
}
|
||||
|
||||
LRESULT CALLBACK EmptyWindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
return DefWindowProc(hWnd, uMsg, wParam, lParam);
|
||||
return DefWindowProc(hWnd, uMsg, wParam, lParam);
|
||||
}
|
||||
|
||||
// Registers a minimal window class for passing to the dll function
|
||||
ATOM RegisterBlankClass(HINSTANCE hInstance)
|
||||
ATOM RegisterBlankClass(HINSTANCE hInstance, HINSTANCE hPrevInstance)
|
||||
{
|
||||
WNDCLASSEX wcex;
|
||||
WNDCLASSEX wcex;
|
||||
ATOM Ret;
|
||||
|
||||
wcex.cbSize = sizeof(WNDCLASSEX);
|
||||
if (!hPrevInstance)
|
||||
{
|
||||
wcex.cbSize = sizeof(WNDCLASSEX);
|
||||
|
||||
wcex.style = 0;
|
||||
wcex.lpfnWndProc = EmptyWindowProc;
|
||||
wcex.cbClsExtra = 0;
|
||||
wcex.cbWndExtra = 0;
|
||||
wcex.hInstance = hInstance;
|
||||
wcex.hIcon = 0;
|
||||
wcex.hCursor = 0;
|
||||
wcex.hbrBackground = 0;
|
||||
wcex.lpszMenuName = 0;
|
||||
wcex.lpszClassName = rundll32_wclass;
|
||||
wcex.hIconSm = 0;
|
||||
wcex.style = 0;
|
||||
wcex.lpfnWndProc = EmptyWindowProc;
|
||||
wcex.cbClsExtra = 0;
|
||||
wcex.cbWndExtra = 0;
|
||||
wcex.hInstance = hInstance;
|
||||
wcex.hIcon = 0;
|
||||
wcex.hCursor = 0;
|
||||
wcex.hbrBackground = 0;
|
||||
wcex.lpszMenuName = 0;
|
||||
wcex.lpszClassName = rundll32_wclass;
|
||||
wcex.hIconSm = 0;
|
||||
}
|
||||
|
||||
Ret = RegisterClassEx(&wcex);
|
||||
if (!Ret) return FALSE;
|
||||
|
||||
return RegisterClassEx(&wcex);
|
||||
return Ret;
|
||||
}
|
||||
|
||||
int WINAPI WinMain(
|
||||
|
@ -331,149 +338,152 @@ int WINAPI WinMain(
|
|||
int nCmdShow
|
||||
)
|
||||
{
|
||||
int argc;
|
||||
TCHAR szMsg[RC_STRING_MAX_SIZE];
|
||||
int argc;
|
||||
TCHAR szMsg[RC_STRING_MAX_SIZE];
|
||||
|
||||
LPTSTR *argv;
|
||||
LPTSTR lptCmdLine,lptDllName,lptFuncName,lptMsgBuffer;
|
||||
LPSTR lpFuncName,lpaCmdLine;
|
||||
LPWSTR lpwCmdLine;
|
||||
HMODULE hDll;
|
||||
DllWinMainW fnDllWinMainW;
|
||||
DllWinMainA fnDllWinMainA;
|
||||
HWND hWindow;
|
||||
int nRetVal,i;
|
||||
size_t nStrLen;
|
||||
LPTSTR *argv;
|
||||
LPTSTR lptCmdLine,lptDllName,lptFuncName,lptMsgBuffer;
|
||||
LPSTR lpFuncName,lpaCmdLine;
|
||||
LPWSTR lpwCmdLine;
|
||||
HMODULE hDll;
|
||||
DllWinMainW fnDllWinMainW;
|
||||
DllWinMainA fnDllWinMainA;
|
||||
HWND hWindow;
|
||||
int nRetVal,i;
|
||||
size_t nStrLen;
|
||||
|
||||
// Get command-line in argc-argv format
|
||||
argv = CommandLineToArgv(GetCommandLine(),&argc);
|
||||
// Get command-line in argc-argv format
|
||||
argv = CommandLineToArgv(GetCommandLine(),&argc);
|
||||
|
||||
// Skip all beginning arguments starting with a slash (/)
|
||||
for (i = 1; i < argc; i++)
|
||||
if (*argv[i] != _T('/')) break;
|
||||
// Skip all beginning arguments starting with a slash (/)
|
||||
for (i = 1; i < argc; i++)
|
||||
if (*argv[i] != _T('/')) break;
|
||||
|
||||
// If no dll was specified, there is nothing to do
|
||||
if (i >= argc) {
|
||||
if (argv) free(argv);
|
||||
return 0;
|
||||
}
|
||||
// If no dll was specified, there is nothing to do
|
||||
if (i >= argc) {
|
||||
if (argv) free(argv);
|
||||
return 0;
|
||||
}
|
||||
|
||||
lptDllName = argv[i++];
|
||||
lptDllName = argv[i++];
|
||||
|
||||
// The next argument, which specifies the name of the dll function,
|
||||
// can either have a comma between it and the dll filename or a space.
|
||||
// Using a comma here is the preferred method
|
||||
if (i < argc)
|
||||
lptFuncName = argv[i++];
|
||||
else
|
||||
lptFuncName = _T("");
|
||||
// The next argument, which specifies the name of the dll function,
|
||||
// can either have a comma between it and the dll filename or a space.
|
||||
// Using a comma here is the preferred method
|
||||
if (i < argc)
|
||||
lptFuncName = argv[i++];
|
||||
else
|
||||
lptFuncName = _T("");
|
||||
|
||||
// If no function name was specified, nothing needs to be done
|
||||
if (!*lptFuncName) {
|
||||
if (argv) free(argv);
|
||||
return 0;
|
||||
}
|
||||
// If no function name was specified, nothing needs to be done
|
||||
if (!*lptFuncName) {
|
||||
if (argv) free(argv);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// The rest of the arguments will be passed to dll function
|
||||
if (i < argc)
|
||||
lptCmdLine = argv[i];
|
||||
else
|
||||
lptCmdLine = _T("");
|
||||
// The rest of the arguments will be passed to dll function
|
||||
if (i < argc)
|
||||
lptCmdLine = argv[i];
|
||||
else
|
||||
lptCmdLine = _T("");
|
||||
|
||||
nRetVal = 0;
|
||||
nRetVal = 0;
|
||||
|
||||
// Everything is all setup, so load the dll now
|
||||
hDll = LoadLibrary(lptDllName);
|
||||
if (hDll) {
|
||||
nStrLen = _tcslen(lptFuncName);
|
||||
// Make a non-unicode version of the function name,
|
||||
// since that is all GetProcAddress accepts
|
||||
lpFuncName = DuplicateToMultiByte(lptFuncName,nStrLen + 2);
|
||||
// Everything is all setup, so load the dll now
|
||||
hDll = LoadLibrary(lptDllName);
|
||||
if (hDll) {
|
||||
nStrLen = _tcslen(lptFuncName);
|
||||
// Make a non-unicode version of the function name,
|
||||
// since that is all GetProcAddress accepts
|
||||
lpFuncName = DuplicateToMultiByte(lptFuncName,nStrLen + 2);
|
||||
|
||||
#ifdef UNICODE
|
||||
lpFuncName[nStrLen] = 'W';
|
||||
lpFuncName[nStrLen+1] = 0;
|
||||
// Get address of unicode version of the dll function if it exists
|
||||
fnDllWinMainW = (DllWinMainW)GetProcAddress(hDll,lpFuncName);
|
||||
fnDllWinMainA = 0;
|
||||
if (!fnDllWinMainW) {
|
||||
// If no unicode function was found, get the address of the non-unicode function
|
||||
lpFuncName[nStrLen] = 'A';
|
||||
fnDllWinMainA = (DllWinMainA)GetProcAddress(hDll,lpFuncName);
|
||||
if (!fnDllWinMainA) {
|
||||
// If first non-unicode function was not found, get the address
|
||||
// of the other non-unicode function
|
||||
lpFuncName[nStrLen] = 0;
|
||||
fnDllWinMainA = (DllWinMainA)GetProcAddress(hDll,lpFuncName);
|
||||
}
|
||||
}
|
||||
lpFuncName[nStrLen] = 'W';
|
||||
lpFuncName[nStrLen+1] = 0;
|
||||
// Get address of unicode version of the dll function if it exists
|
||||
fnDllWinMainW = (DllWinMainW)GetProcAddress(hDll,lpFuncName);
|
||||
fnDllWinMainA = 0;
|
||||
if (!fnDllWinMainW) {
|
||||
// If no unicode function was found, get the address of the non-unicode function
|
||||
lpFuncName[nStrLen] = 'A';
|
||||
fnDllWinMainA = (DllWinMainA)GetProcAddress(hDll,lpFuncName);
|
||||
if (!fnDllWinMainA) {
|
||||
// If first non-unicode function was not found, get the address
|
||||
// of the other non-unicode function
|
||||
lpFuncName[nStrLen] = 0;
|
||||
fnDllWinMainA = (DllWinMainA)GetProcAddress(hDll,lpFuncName);
|
||||
}
|
||||
}
|
||||
#else
|
||||
// Get address of non-unicode version of the dll function if it exists
|
||||
fnDllWinMainA = (DllWinMainA)GetProcAddress(hDll,lpFuncName);
|
||||
fnDllWinMainW = 0;
|
||||
if (!fnDllWinMainA) {
|
||||
// If first non-unicode function was not found, get the address
|
||||
// of the other non-unicode function
|
||||
lpFuncName[nStrLen] = 'A';
|
||||
lpFuncName[nStrLen+1] = 0;
|
||||
fnDllWinMainA = (DllWinMainA)GetProcAddress(hDll,lpFuncName);
|
||||
if (!fnDllWinMainA) {
|
||||
// If non-unicode function was not found, get the address of the unicode function
|
||||
lpFuncName[nStrLen] = 'W';
|
||||
fnDllWinMainW = (DllWinMainW)GetProcAddress(hDll,lpFuncName);
|
||||
}
|
||||
}
|
||||
// Get address of non-unicode version of the dll function if it exists
|
||||
fnDllWinMainA = (DllWinMainA)GetProcAddress(hDll,lpFuncName);
|
||||
fnDllWinMainW = 0;
|
||||
if (!fnDllWinMainA) {
|
||||
// If first non-unicode function was not found, get the address
|
||||
// of the other non-unicode function
|
||||
lpFuncName[nStrLen] = 'A';
|
||||
lpFuncName[nStrLen+1] = 0;
|
||||
fnDllWinMainA = (DllWinMainA)GetProcAddress(hDll,lpFuncName);
|
||||
if (!fnDllWinMainA) {
|
||||
// If non-unicode function was not found, get the address of the unicode function
|
||||
lpFuncName[nStrLen] = 'W';
|
||||
fnDllWinMainW = (DllWinMainW)GetProcAddress(hDll,lpFuncName);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
free(lpFuncName);
|
||||
free(lpFuncName);
|
||||
|
||||
RegisterBlankClass(hInstance);
|
||||
// Create a window so we can pass a window handle to
|
||||
// the dll function; this is required
|
||||
hWindow = CreateWindowEx(0,rundll32_wclass,rundll32_wtitle,0,CW_USEDEFAULT,0,CW_USEDEFAULT,0,0,0,hInstance,0);
|
||||
if (!RegisterBlankClass(hInstance, hPrevInstance))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
// Create a window so we can pass a window handle to
|
||||
// the dll function; this is required
|
||||
hWindow = CreateWindowEx(0,rundll32_wclass,rundll32_wtitle,0,CW_USEDEFAULT,0,CW_USEDEFAULT,0,0,0,hInstance,0);
|
||||
|
||||
if (fnDllWinMainW) {
|
||||
// Convert the command-line string to unicode and call the dll function
|
||||
lpwCmdLine = ConvertToWideChar(lptCmdLine);
|
||||
nRetVal = fnDllWinMainW(hWindow,hInstance,lpwCmdLine,nCmdShow);
|
||||
FreeConvertedWideChar(lpwCmdLine);
|
||||
}
|
||||
else if (fnDllWinMainA) {
|
||||
// Convert the command-line string to ansi and call the dll function
|
||||
lpaCmdLine = ConvertToMultiByte(lptCmdLine);
|
||||
nRetVal = fnDllWinMainA(hWindow,hInstance,lpaCmdLine,nCmdShow);
|
||||
FreeConvertedMultiByte(lpaCmdLine);
|
||||
}
|
||||
else {
|
||||
// The specified dll function was not found; display an error message
|
||||
GetModuleTitle();
|
||||
if (fnDllWinMainW) {
|
||||
// Convert the command-line string to unicode and call the dll function
|
||||
lpwCmdLine = ConvertToWideChar(lptCmdLine);
|
||||
nRetVal = fnDllWinMainW(hWindow,hInstance,lpwCmdLine,nCmdShow);
|
||||
FreeConvertedWideChar(lpwCmdLine);
|
||||
}
|
||||
else if (fnDllWinMainA) {
|
||||
// Convert the command-line string to ansi and call the dll function
|
||||
lpaCmdLine = ConvertToMultiByte(lptCmdLine);
|
||||
nRetVal = fnDllWinMainA(hWindow,hInstance,lpaCmdLine,nCmdShow);
|
||||
FreeConvertedMultiByte(lpaCmdLine);
|
||||
}
|
||||
else {
|
||||
// The specified dll function was not found; display an error message
|
||||
GetModuleTitle();
|
||||
LoadString( GetModuleHandle(NULL), IDS_MissingEntry, (LPTSTR) szMsg,RC_STRING_MAX_SIZE);
|
||||
|
||||
lptMsgBuffer = (LPTSTR)malloc((_tcslen(szMsg) - 4 + _tcslen(lptFuncName) + _tcslen(lptDllName) + 1) * sizeof(TCHAR));
|
||||
_stprintf(lptMsgBuffer,szMsg,lptFuncName,lptDllName);
|
||||
MessageBox(0,lptMsgBuffer,ModuleTitle,MB_ICONERROR);
|
||||
free(lptMsgBuffer);
|
||||
}
|
||||
lptMsgBuffer = (LPTSTR)malloc((_tcslen(szMsg) - 4 + _tcslen(lptFuncName) + _tcslen(lptDllName) + 1) * sizeof(TCHAR));
|
||||
_stprintf(lptMsgBuffer,szMsg,lptFuncName,lptDllName);
|
||||
MessageBox(0,lptMsgBuffer,ModuleTitle,MB_ICONERROR);
|
||||
free(lptMsgBuffer);
|
||||
}
|
||||
|
||||
DestroyWindow(hWindow);
|
||||
UnregisterClass(rundll32_wclass,hInstance);
|
||||
DestroyWindow(hWindow);
|
||||
UnregisterClass(rundll32_wclass,hInstance);
|
||||
|
||||
// The dll function has finished executing, so unload it
|
||||
FreeLibrary(hDll);
|
||||
}
|
||||
else {
|
||||
// The dll could not be loaded; display an error message
|
||||
GetModuleTitle();
|
||||
LoadString( GetModuleHandle(NULL), IDS_DllNotLoaded, (LPTSTR) szMsg,RC_STRING_MAX_SIZE);
|
||||
// The dll function has finished executing, so unload it
|
||||
FreeLibrary(hDll);
|
||||
}
|
||||
else {
|
||||
// The dll could not be loaded; display an error message
|
||||
GetModuleTitle();
|
||||
LoadString( GetModuleHandle(NULL), IDS_DllNotLoaded, (LPTSTR) szMsg,RC_STRING_MAX_SIZE);
|
||||
|
||||
lptMsgBuffer = (LPTSTR)malloc((_tcslen(szMsg) - 2 + _tcslen(lptDllName) + 1) * sizeof(TCHAR));
|
||||
_stprintf(lptMsgBuffer,szMsg,lptDllName);
|
||||
lptMsgBuffer = (LPTSTR)malloc((_tcslen(szMsg) - 2 + _tcslen(lptDllName) + 1) * sizeof(TCHAR));
|
||||
_stprintf(lptMsgBuffer,szMsg,lptDllName);
|
||||
|
||||
MessageBox(0,lptMsgBuffer,ModuleTitle,MB_ICONERROR);
|
||||
free(lptMsgBuffer);
|
||||
}
|
||||
MessageBox(0,lptMsgBuffer,ModuleTitle,MB_ICONERROR);
|
||||
free(lptMsgBuffer);
|
||||
}
|
||||
|
||||
if (argv) free(argv);
|
||||
return nRetVal;
|
||||
if (argv) free(argv);
|
||||
return nRetVal;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue