MCPcopy Create free account
hub / github.com/DFIR-ORC/dfir-orc / StringFromResourceId

Function StringFromResourceId

tools/rcedit/src/cmd/list/resources.cpp:27–52  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25using ResourceLangDir = rcedit::Resources::ResourceLangDir;
26
27std::wstring StringFromResourceId( LPCWSTR resId )
28{
29 const std::wstring kNaN( L"#NaN" );
30
31 if( resId == nullptr ) {
32 return kNaN;
33 }
34
35 // TODO: did not found a size limit on resource size
36 if( IS_INTRESOURCE( resId ) == FALSE ) {
37 return resId;
38 }
39
40#pragma warning( push )
41#pragma warning( disable : 4302 )
42 const WORD id = reinterpret_cast<size_t>(resId) & 0xFFFF;
43#pragma warning( pop )
44
45 try {
46 return L"#" + std::to_wstring( id );
47 }
48 catch( const std::exception& e ) {
49 spdlog::debug( "Failed to convert resource id: {}", e.what() );
50 return kNaN;
51 }
52}
53
54BOOL CALLBACK EnumResourceTypeCb( HMODULE, LPWSTR lpType, LONG_PTR lParam )
55{

Callers 2

EnumResourceTypeCbFunction · 0.85
EnumResourceNamesCbFunction · 0.85

Calls 1

whatMethod · 0.80

Tested by

no test coverage detected