473,394 Members | 1,742 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

static data structs in win32 DLL, hex editor

A shot in the dark. I have a C++ DLL that I'd prefer not to recompile.
It's compiled also on a Unix platform as a shared object. It has
static variables holding time zone Daylight Saving rules. I thought I
might try to use a hex editor to update the rules for the change coming
up in March. There's a pair of structs, each with 4 ints which
describe the start/end of DST. It's clear as day in the Unix shared
object, but I can not find it in the Windows DLL. It was compiled with
msvc++.net 2003. Taking endianess into account, and alignment I search
through a hex dump and the structs don't show up in any form. For
example

struct A { int a,b,c,d; };
struct B { struct A x,y; };

static struct B tz = { {3,1,0,120},{10,0,0,120} };

I expect to find bytes like this 03000000 01000000 00000000 78000000
which is a hex string of the first four ints above in little endian
byte order. Any clue why I don't find it?

Thanks,
Kendall

Jan 16 '07 #1
4 2450
On 16 Jan 2007 11:32:09 -0800, "Kendall Bailey" <kr******@gmail.com>
wrote in comp.lang.c:
A shot in the dark. I have a C++ DLL that I'd prefer not to recompile.
It's compiled also on a Unix platform as a shared object. It has
static variables holding time zone Daylight Saving rules. I thought I
might try to use a hex editor to update the rules for the change coming
up in March. There's a pair of structs, each with 4 ints which
describe the start/end of DST. It's clear as day in the Unix shared
object, but I can not find it in the Windows DLL. It was compiled with
msvc++.net 2003. Taking endianess into account, and alignment I search
through a hex dump and the structs don't show up in any form. For
example

struct A { int a,b,c,d; };
struct B { struct A x,y; };

static struct B tz = { {3,1,0,120},{10,0,0,120} };

I expect to find bytes like this 03000000 01000000 00000000 78000000
which is a hex string of the first four ints above in little endian
byte order. Any clue why I don't find it?
Each and every one of the following items in your post is off-topic
here, having nothing to do with the C language:

1. C++
2. DLL
3. UNIX
4. shared object
5. hex editor
6. msvc++.net 2003
7. hex dump

If you want to know how to find things in DLLs, ask in a Microsoft
programming group.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://c-faq.com/
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html
Jan 17 '07 #2
Each and every one of the following items in your post is off-topic
here, having nothing to do with the C language:
Jack Klein
Home: http://JK-Technology.Com
OK, ok. More theoretically... is a questions about static data
structures defined in a compilation unit being represented in a binary
execution format more on topic? Across all implementations of the C
language, how varied are the final binaries which hold the static data
that is used to initialize a static struct? Are there compilers that
generate executable code which sets the fields one by one? Is there a
general taxonomy of C compiler implementations with respect to static
initializers?

Sorry about so many specifics the first time around. I'm curious about
the theoretical mapping of C language constructs to binary code. My
expectations proved false for one platform, but true for another.
Consider it background info and look at the broader question. I asked
for any speculations, and I'm happy to hear any open ended,
non-specific, answers.

Jan 17 '07 #3
Kendall Bailey wrote:
Each and every one of the following items in your post is off-topic
here, having nothing to do with the C language:
Jack Klein
Home: http://JK-Technology.Com

OK, ok. More theoretically... is a questions about static data
structures defined in a compilation unit being represented in a binary
execution format more on topic? Across all implementations of the C
language, how varied are the final binaries which hold the static data
that is used to initialize a static struct? Are there compilers that
generate executable code which sets the fields one by one? Is there a
general taxonomy of C compiler implementations with respect to static
initializers?

Sorry about so many specifics the first time around. I'm curious about
the theoretical mapping of C language constructs to binary code. My
expectations proved false for one platform, but true for another.
Consider it background info and look at the broader question. I asked
for any speculations, and I'm happy to hear any open ended,
non-specific, answers.
Yes, as you note, code and data generation is implementation specific
and varies according to the machine, operating system, compiler etc.

This question is better posted to comp.compilers or to a specific
compiler group like gnu.gcc.help etc.

Jan 17 '07 #4
In article <11**********************@11g2000cwr.googlegroups. com>,
Kendall Bailey <kr******@gmail.comwrote:
>I have a C++ DLL that I'd prefer not to recompile.
>There's a pair of structs, each with 4 ints which
describe the start/end of DST. It's clear as day in the Unix shared
object, but I can not find it in the Windows DLL.
>struct A { int a,b,c,d; };
struct B { struct A x,y; };
>static struct B tz = { {3,1,0,120},{10,0,0,120} };
>I expect to find bytes like this 03000000 01000000 00000000 78000000
which is a hex string of the first four ints above in little endian
byte order. Any clue why I don't find it?
Construct a sample case and compile it with the appropriate compiler
and disassemble the result to see how that particular compiler handles
such things.

Note, by the way, that "little-endian" includes the byte order
2143 (e.g., 00000300), not just 4321; you should test to
confirm that the byte order is what you were expecting.
--
Okay, buzzwords only. Two syllables, tops. -- Laurie Anderson
Jan 17 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: cppsks | last post by:
"Defining static const variables inside the class is not universally supported yet, so for now I guess you'll have to move the definition out of the body of the class. No, static const inside...
4
by: Bill | last post by:
I would like to create a static array of classes (or structs) to be used in populating name/value pairs in various WebForm drop down list boxes, but am not quite sure of the construct (or rather to...
9
by: AnandRaj | last post by:
Hi guys, I have a few doubts in C. 1. Why static declartions are not allowed inside structs? eg struct a { static int i; }; Throws an error ..
14
by: SD | last post by:
I am thinking about writing a text editor in C for unix sometime soon. I am just doing this to learn more about C. I want to write something like ed.c, a simple line editor. What types of data...
12
by: Mars | last post by:
I searched and found quite many, but (nearly) all are about C++....... Any recommendation for such reference for pure C???? Thx~~~~ Mars.
5
by: Dirk Reske | last post by:
hello, I have following problem: I have a struct "MainStruct" now I want to build structs which all "starts" with MainStruct. struct1 { MainStruct var;
4
by: Andre | last post by:
Hi, I have a static Lib and I want to use it in C#. So, I tried to wrap these functions in a DLL (not in a class) and use . But this doesn't work. Is it possible to wrap this in a DLL not...
3
by: Mike - EMAIL IGNORED | last post by:
MyClass { //I have a static member method: void static myMethod(); //and a static data member: static MyType myData; }; //In the .cpp file: void MyClass::myMethod()
9
by: Tarscher | last post by:
hi all, I have this seemingly simple problem. I have lost a lot of time on it though. When a user selects a value from a dropdownlist (static control) a dynamic control is generated. I have...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.