Имя пользователя:
Пароль:  
Помощь | Регистрация | Забыли пароль?  

Показать сообщение отдельно

Старожил


Сообщения: 341
Благодарности: 128

Профиль | Сайт | Отправить PM | Цитировать


regist, Признаюсь, зацепили
Не поленился, полез в отладчики/дизассемблеры, добрался до функции LdrpSearchResourceSection из ntdll.dll
читать дальше »
Цитата:
// Language ids are 16bits so any value with any bits
// set above 16 should be ok, and this value only has
// to fit in a ULONG_PTR. 0x10000 should be sufficient.
// The value used is actually 0xFFFF regardless of 32bit or 64bit,
// I guess assuming this is not an actual langid, which it isn't,
// due to the relatively small number of languages, around 70.
#define USE_FIRSTAVAILABLE_LANGID (0xFFFFFFFF & ~LDR_RESOURCE_ID_NAME_MASK)

NTSTATUS
LdrpSearchResourceSection_U(
IN PVOID DllHandle,
IN const ULONG_PTR* ResourceIdPath,
IN ULONG ResourceIdPathLength,
IN ULONG Flags,
OUT PVOID *ResourceDirectoryOrData
)

/*++

Routine Description:

This function locates the address of the specified resource in the
specified DLL and returns its address.

Arguments:

DllHandle - Supplies a handle to the image file that the resource is
contained in.

ResourceIdPath - Supplies a pointer to an array of 32-bit resource
identifiers. Each identifier is either an integer or a pointer
to a null terminated string (PSZ) that specifies a resource
name. The array is used to traverse the directory structure
contained in the resource section in the image file specified by
the DllHandle parameter.

ResourceIdPathLength - Supplies the number of elements in the
ResourceIdPath array.

Flags -
LDRP_FIND_RESOURCE_DIRECTORY
searching for a resource directory, otherwise the caller is
searching for a resource data entry.

LDR_FIND_RESOURCE_LANGUAGE_EXACT
searching for a resource with, and only with, the language id
specified in ResourceIdPath, otherwise the caller wants the routine
to come up with default when specified langid is not found.

LDR_FIND_RESOURCE_LANGUAGE_REDIRECT_VERSION
searching for a resource version in main and alternative
modules paths

FindDirectoryEntry - Supplies a boolean that is TRUE if caller is
searching for a resource directory, otherwise the caller is
searching for a resource data entry.

ExactLangMatchOnly - Supplies a boolean that is TRUE if caller is
searching for a resource with, and only with, the language id
specified in ResourceIdPath, otherwise the caller wants the routine
to come up with default when specified langid is not found.

ResourceDirectoryOrData - Supplies a pointer to a variable that will
receive the address of the resource directory or data entry in
the resource data section of the image file specified by the
DllHandle parameter.
--*/

Полная версия http://gate.upm.ro/os/LABs/Windows_O.../rtl/ldrrsrc.c
В ней можно увидеть комментарии про варианты поиска ресурса
читать дальше »
Цитата:
//
// If search path includes a language id, then attempt to
// match the following language ids in this order:
//
// (0) use given language id
// (1) use primary language of given language id
// (2) use id 0 (neutral resource)
// (4) use user UI language
//
// If the PRIMARY language id is ZERO, then ALSO attempt to
// match the following language ids in this order:
//
// (3) use thread language id for console app
// (4) use user UI language
// (5) use lang id of TEB for windows app if it is different from user locale
// (6) use UI lang from exe resource
// (7) use primary UI lang from exe resource
// (8) use Install Language
// (9) use lang id from user's locale id
// (10) use primary language of user's locale id
// (11) use lang id from system default locale id
// (12) use lang id of system default locale id
// (13) use primary language of system default locale id
// (14) use US English lang id
// (15) use any lang id that matches requested info


P.S.
1. Признаю, что использование "use id 0 (neutral resource)" будет более правильным
2. Не признаю, что текущий вариант не сработает где-либо

-------
http://7zsfx.info


Последний раз редактировалось Oleg_Sch, 28-03-2016 в 14:10. Причина: P.S.


Отправлено: 14:01, 28-03-2016 | #1713