Exetools  

Go Back   Exetools > General > General Discussion

Notices

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 04-08-2005, 01:25
dedificator dedificator is offline
Friend
 
Join Date: Oct 2002
Posts: 89
Rept. Given: 4
Rept. Rcvd 16 Times in 6 Posts
Thanks Given: 0
Thanks Rcvd at 4 Times in 4 Posts
dedificator Reputation: 17
If you must only to write these 4 bytes to COMx, this can be done as synchronous write (no need for timeouts e.t.c).
In MS SDK (section WIN32 development, Communications) are some samples in C++ - do needed modifications, build and try. Search MSDN for this.
Requierad parts are:
Create file "COM1" with expected attributes - without Overlapped in sync. op. case,
DCB modification (speed, parity ...) - GetCommState,SetCommState,
Write data to created file,
Close handle.
Output data must be formatted as byte array.

In your case, you can pass pointer to int (0x0101) variable, length =4 as data buffer for WriteFile.

DWORD l = 0; //return value for really sent bytes
DWORD buf = 0x101; // data block 01, 01, 00, 00
WriteFile(hCom, &buf, 4, &l, NULL); //send buffer to opened COM port

or, if response isn't expected
for (int i=3; i>=0; i--) TransmitCommChar(hCom, (BYTE) (i>>1));
this function works very well for comm init strings sending w/o response.

If you must handle some incoming packets too, better would be use async. operations mode with multithreading, else this all can hang up while waiting response ...
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
int3 and stolen bytes ! Newbie_Cracker General Discussion 4 03-14-2007 16:48
Damaged stolen bytes *RemedY* General Discussion 9 05-22-2004 16:58
DVDRegionFree 3.25 Stolen bytes MaRKuS-DJM General Discussion 2 01-05-2004 00:23
22 stolen bytes? SvensK General Discussion 2 11-06-2003 17:13
ASPR: stolen bytes neccessary?! MaRKuS-DJM General Discussion 2 11-05-2003 09:13


All times are GMT +8. The time now is 23:59.


Always Your Best Friend: Aaron, JMI, ahmadmansoor, ZeNiX, chessgod101
( Since 1998 )