Click here to Skip to main content
16,006,475 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: IDE (vc++ 6) Pin
David Crow9-Jun-03 9:26
David Crow9-Jun-03 9:26 
QuestionHow do I correlate IP address and device description to a specific adapter card? Pin
JohnnyG9-Jun-03 8:15
JohnnyG9-Jun-03 8:15 
AnswerRe: How do I correlate IP address and device description to a specific adapter card? Pin
David Crow9-Jun-03 9:33
David Crow9-Jun-03 9:33 
GeneralRe: How do I correlate IP address and device description to a specific adapter card? Pin
JohnnyG9-Jun-03 9:43
JohnnyG9-Jun-03 9:43 
GeneralRe: How do I correlate IP address and device description to a specific adapter card? Pin
David Crow9-Jun-03 10:26
David Crow9-Jun-03 10:26 
GeneralIdentical Resource IDs Pin
smjones9-Jun-03 8:04
smjones9-Jun-03 8:04 
GeneralRe: Identical Resource IDs Pin
Neville Franks9-Jun-03 11:43
Neville Franks9-Jun-03 11:43 
GeneralRe: Identical Resource IDs Pin
Sardaukar9-Jun-03 21:40
Sardaukar9-Jun-03 21:40 
Unfortunately, yes.
I discovered this working inside the company I'm currently employed during the Veritest's "exam" for Windows 2000 Logo.

The problem occured having a central executable and a set of DLLs called from it.
Everything is MFC.

Suppose you have into dll 1 a string resource with IDC_STRING, and into dll 2 a string resource with ID = IDC_STRING2, and IDC_STRING1 = IDC_STRING2. If dll 1 is loaded, loading dll 2 will give in the point of IDC_STRING2 loading a call to FindResource with ID = IDC_STRING1 = IDC_STRING2. Most probably it will find it in dll 1 and load from there, since all are mapped in the same process. If you manually specify the dll instance, that's ok (I think...) but I don't think you call

::LoadString(hInstDll2, IDC_STRING2, szText, sizeof(szText));

instead of

CString str;
str.LoadString(IDC_STRING2);

or

AfxMessageBox(IDC_STRING2).

Things are even worse if you have different or custom resource types. I've seen several crashes so bad just because this resource clash.

In fact this made us to write a resource align tool that reads resource ranges for a dll.
The basic idea is to make a resource partitioning tool (parses .rc and rewrites resource.h) in such a way that:

ResourceIDs(dll_i) AND ResourceIDs(dll_j) = EMPTY

for any i <> j, 1 <= i, j <= n (number of modules using resources you have).

The thing may not be so simple as you think, there are external details to consider.
Think a MDI application that has to specify a CLIENTCREATESTRUCT's ID for first MDI child window. Accordingly to MSDN (and this one is true Smile | :) ) these IDs should not conflict with existing resource IDs. There may be other restrictions as well, I've pointed only one of the most obvious.

A dll starts with a default range of resources of 100.
If the internal parser decides that this is not enough, it will modify the input "ranges" file and adds a new 100 sized range and try to resort the IDs in such way that each resource ID will be placed inside that range. The process is performed until all resource IDs from dll have room in the allocated ranges.
A rebuild all is, of course, required after resource alignment.

In this way, there is no worry that a dll will ever have a resource ID conflicting with another dll's resource IDs.

Now we all live happily Smile | :) , having 3 different development offices compiling all in the same place over main website. The internal objects detects if there are resource changes, these MUST be recorded inside the task (I'm not going into details what a task means and how the website is working, but I think you get the point) and, if a module past outside the range, and automatic aligner component works in conjunction with resource parser tool to get a new range and resort affected resource.h.
Rebuild all (for the dll and all dependent modules) and that's it.

("That's it" = almost 3 months of work Smile | :) from time to time until we get the job done)
GeneralSomething better than atoi Pin
Shay Harel9-Jun-03 7:06
Shay Harel9-Jun-03 7:06 
GeneralRe: Something better than atoi Pin
basementman9-Jun-03 7:10
basementman9-Jun-03 7:10 
GeneralRe: Something better than atoi Pin
Shay Harel9-Jun-03 7:14
Shay Harel9-Jun-03 7:14 
GeneralRe: Something better than atoi Pin
Shay Harel9-Jun-03 7:16
Shay Harel9-Jun-03 7:16 
GeneralRe: Something better than atoi Pin
basementman9-Jun-03 7:27
basementman9-Jun-03 7:27 
GeneralRe: Something better than atoi Pin
Shay Harel9-Jun-03 7:37
Shay Harel9-Jun-03 7:37 
GeneralRe: Something better than atoi Pin
David Crow9-Jun-03 9:38
David Crow9-Jun-03 9:38 
GeneralTranslation Pin
sardinka9-Jun-03 6:54
sardinka9-Jun-03 6:54 
GeneralRe: Translation Pin
Shay Harel9-Jun-03 7:08
Shay Harel9-Jun-03 7:08 
GeneralRe: Translation Pin
sardinka9-Jun-03 8:19
sardinka9-Jun-03 8:19 
GeneralRe: Translation Pin
Shay Harel9-Jun-03 8:24
Shay Harel9-Jun-03 8:24 
GeneralRe: Translation Pin
sardinka9-Jun-03 8:37
sardinka9-Jun-03 8:37 
GeneralRe: Translation Pin
David Crow9-Jun-03 9:50
David Crow9-Jun-03 9:50 
GeneralRe: Translation Pin
sardinka10-Jun-03 2:18
sardinka10-Jun-03 2:18 
GeneralRe: Translation Pin
sardinka10-Jun-03 6:33
sardinka10-Jun-03 6:33 
GeneralRe: Translation Pin
David Crow10-Jun-03 6:49
David Crow10-Jun-03 6:49 
GeneralRe: Translation Pin
sardinka10-Jun-03 7:47
sardinka10-Jun-03 7:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.