File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed
Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -867,6 +867,12 @@ static PIMAGE_RESOURCE_DIRECTORY_ENTRY _MemorySearchResourceEntryA(
867867 LPCSTR key )
868868{
869869 PIMAGE_RESOURCE_DIRECTORY_ENTRY result = NULL ;
870+ size_t searchKeyLen ;
871+ #define MAX_LOCAL_KEY_LENGTH 2048
872+ // In most cases resource names are short, so optimize for that by
873+ // using a pre-allocated array.
874+ wchar_t _searchKeySpace [MAX_LOCAL_KEY_LENGTH + 1 ];
875+ LPWSTR _searchKey ;
870876
871877 if (!IS_INTRESOURCE (key ) && key [0 ] == '#' ) {
872878 // special case: resource id given as string
@@ -886,12 +892,7 @@ static PIMAGE_RESOURCE_DIRECTORY_ENTRY _MemorySearchResourceEntryA(
886892
887893 // Resource names are always stored using 16bit characters, need to
888894 // convert string we search for.
889- #define MAX_LOCAL_KEY_LENGTH 2048
890- size_t searchKeyLen = strlen (key );
891- // In most cases resource names are short, so optimize for that by
892- // using a pre-allocated array.
893- wchar_t _searchKeySpace [MAX_LOCAL_KEY_LENGTH + 1 ];
894- LPWSTR _searchKey ;
895+ searchKeyLen = strlen (key );
895896 if (searchKeyLen > MAX_LOCAL_KEY_LENGTH ) {
896897 size_t _searchKeySize = (searchKeyLen + 1 ) * sizeof (wchar_t );
897898 _searchKey = (LPWSTR ) malloc (_searchKeySize );
You can’t perform that action at this time.
0 commit comments