|
Shared memory is a memory, that can be mapped to many processes adress space, thats all. Synchronization between processes using it is in your hands.
nss wrote:
I just want to send an integer over from the dll tothe client
That's really not optimal to use shared memory to do it. If you can't use sendmessage for it, try to send an COM event from your COM object.
Pavel
Sonork 100.15206
|
|
|
|
|
You can use named events (see CreateEvent ): When data is written the DLL can just set it and all the app has to do is WaitForSIngleBoject for the event.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hello everybody
I want to use Internet Authentication Service But AuthIf.h header file is not in my VS 6 package,where can I find it & its libery files?
tnX alot
Iman Ghasrfakhri
|
|
|
|
|
|
Hi.
I am a C++ programmer.
I began learning 16-bit ASM and practice 16-bit ASM programming under DOS and MASM 6.x three weeks ago. I am very impressed with ASM and the control and simplicity ASM brings to programming. 16-bit ASM is so simple. Programmers have the most flexibility in terms of program design. I enjoy ASM programming and will definitely continue learning and practicing 16-bit ASM.
I have some basic, but essential, questions on implementing 16-bit, 32-bit, and 64-bit assembly in C++ programs.
1) Under what circumstances in additional to device drivers development do programmers use 16-bit and 32-bit ASM? I am most interested in 16-bit ASM when using ASM only.
2) Under what circumstances do C++ programmers incorporate 16-bit and/or 32-bit ASM in C++ programs? Please be as specific as possible. For example, under what conditions do 16-bit and 32-bit ASM out-perform C++? I am most interested in the Windows environment when using C++ and ASM.
Is it possible to apply 16-bit ASM in C++ Windows programs? Again, C++ does all the messaging. I want to incorporate ASM it is called for.
Thanks,
Kuphryn
|
|
|
|
|
kuphryn wrote:
Under what circumstances in additional to device drivers development do programmers use 16-bit and 32-bit ASM?
IA16 assembler is used mostly for writing bootsector code.
IA32 assembler is used whenever the compiler can't provide the speed, or instructions, needed to perform a given task at a given speed. F.ex. compilers usually don't (never?) generate e.g. MMX code for plain C/C++.
Is it possible to apply 16-bit ASM in C++ Windows programs?
Yes. Ever version of windows up to (not including) Windows 4.0 (Windows 95) was completely 16-bit. Win9x uses a lot of 16-bit code internally, and is actually more of a 32-bit shell on top of a 16-bit OS than anything else. For Windows version based on the NT kernel the only trace of 16-bit code you'll find is AFAIK the boot loader.
Tweaking your question a bit to read "Is it even remotely useful to apply 16-bit ASM ...", the answer becomes: No. Why on earth would anyone want to punish themselves with that horror?
|
|
|
|
|
Okay.
You made a very good point about how recent versions of Windows make little use of 16-bit ASM. I believe 16-bit ASM is good for use in pure DOS and to communicate directly with hardware in pure DOS mode. In that case, how does 16-bit ASM come into effect? Can you use 32-bit or 64-bit ASM to communicate with hardware?
Kuphryn
|
|
|
|
|
kuphryn wrote:
Can you use 32-bit or 64-bit ASM to communicate with hardware?
Since you can express anything in assembler that you also can do with another language (usually with much more work in assembler though), and any Win32 hardware device driver is written in (combinations of) C/C++/assembler, obviously you can communicate with hardware using assembler.
For 64-bit I feel I have to ask: Do you really know anyone even having seen a live Itanium Windows system, much less owns one?
|
|
|
|
|
I'm learning to buid Xtras for Director
with XtraBuilder (that's a very good
tool for beginners) and Visual C++,
before starting studying XDK.
Simply I ask if somebody know if there
is somewhat similar to XtraBuilder for
Mac and Codewarrior. - Many thanks.
|
|
|
|
|
I use VB.NET or VB6 to call a DLL routine which is written in C (WinPCap). It has "bad calling convention" error. I check the C code and found that it has code for EXPORT in def file but it doesn't has "extern..." or "__stdcall" code in calling function. So, I change
BOOLEAN PacketGetAdapterNames(PTSTR pStr,PULONG BufferSize)
to
extern "C" { __declspec(dllexport) BOOL __stdcall packetfunc(PTSTR s, PULONG BufferSize)
.
.
}
I compile the orginal code ('C' Code) without any error but when I compile the new code (add extern and __stdcall) either in C/C++. I got a lot of error such as "missing string", missing ";". Quite Strange. Anyone has idea ?
Orginal C file is in this link:
http://winpcap.polito.it/install/bin/WPcapSrc_2_3.zip
Many Many Thanks
Danny
|
|
|
|
|
if i have the DWORD for example
DWORD temp;
i want to set the value of each byte seperately how to set it.
i want to get the value of each byte seperately how to get it.
r00d0034@yahoo.com
|
|
|
|
|
to set
DWORD dw = 0;
BYTE a = 2;
BYTE b = 3;
BYTE c = 4;
BYTE d = 8;
dw = a;
dw = dw << 8;
dw |= b;
dw = dw << 8;
dw |= c;
dw = dw << 8;
dw |= d;
to get:
BYTE a,b,c,d;
a = dw & 0x000000ff;
b = (BYTE)((DWORD)(dw & 0x0000ff00) >> 8);
c = (BYTE)((DWORD)(dw & 0x00ff0000) >> 16);
d = (BYTE)((DWORD)(dw & 0xff000000) >> 24);
-c
As always, it's bread and circuses. And while bread is down right now, circuses are way up.
|
|
|
|
|
Nice!
Hey, is it possible to use ASM to get and/or set individual bytes from larger datatype such as WORD, DWORD, etc? Understand this situation, how does ASM performance compared to normal C/C++ solution?
Kuphryn
|
|
|
|
|
Yes, but doing so will not get you anything because the C bitwise operators translate exactly into assmbly instructions like AND, OR, SHL (shift left), etc.
--Mike--
Just released - RightClick-Encrypt v1.4 - Adds fast & easy file encryption to Explorer
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
Okay. Well, ASM concepts and syntax are easier to remember than C/C++. There is not reference required for the most part.
Kuphryn
|
|
|
|
|
|
one question.
when you set the values
a = most significant byte
d = less significan byte
And when you get them
a = less significant byte
d = most significant byte
is this correct?
|
|
|
|
|
|
Just one point (in case Imran is confused)
In Chris L's "set" example, a is the MSByte and d is the LSByte
In his "get" example, he's kinda reversed it so that :-
a is the LSByte and d is the MSByte
Thought I'd mention it here.
Regards,
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Review by Shog9
Click here for review[NW]
|
|
|
|
|
Don't you like the MAKELONG and MAKEWORD macros?
|
|
|
|
|
u can use this structur & union to do it
union {
DWORD a;
struct {
_1:1;
_2:1;
_3:1;
_4:1;
_5:1;
_6:1;
_7:1;
_8:1;
_9:1;
_10:1;
_11:1;
_12:1;
_13:1;
_14:1;
_15:1;
_16:1;
}bits;
}DW;
you can use that struct
to set a bit first palce your DWORD var to "DW.a" then set bits:
DW.a = YourVar;
DW.bits._1 = 1;//set the first bit to one
DW.bits._2 = 0;//set th second bit to zero
.
.
.
YourVar = DW.a;
Iman Ghasrfakhri
|
|
|
|
|
|
When I compile my program I keep getting errors that some symbols are multiply defined. The items in question are in a global hearder file that each class needs to include so I assume this is where the problem exists, in that the file is being included into every class and producing the errors. I tried putting include guards on the header file but it doesn't change anything. Any help in this matter would be much appreciated.
Thanks in advance.
- Monrobot13
|
|
|
|
|
In the file that every other file includes, I assume you have something like:
var_type iSomeGlobVar;
Replace it with:
extern var_type iSomeGlobVar;
then, in some .cpp file (the one that goes with the .h one, if possible):
var_type iSomeGlobVar;
That should fix it.
Michel
It is a lovely language, but it takes a very long time to say anything in it, because we do not say anything in it, unless it is worth taking a very long time to say, and to listen to.
- TreeBeard
|
|
|
|
|
Thanks Michel, just one quick question, will this same procedure work for functions and structs?
Monrobot13
|
|
|
|