Due to some brain damage, (either in windows or in me), there appears to be no API to get the size of a windows resource produced by LoadResource. The return type is HANDLE, but it's not a real handle, and GlobalSize does not work on it.
So absent the API, I need to embed my blobs in some simple format that will wrap them with their length. Surely there must be a util开发者_运维百科ity somewhere that rewrites a file as a length, followed by the contents of the file, or some such trivial encoding.
Not an answer to your question as to a helper for the work-around, but the API is not missing.
When you called LoadResource, you passed in the module handle and a HRSRC handle. If you call SizeOfResource with the same arguments, it returns the size of the resource.
精彩评论