Click here to Skip to main content
15,886,110 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
AnswerRe: CoCreateInstance Problem & GetLastError 0x0000007e Pin
Stephen Hewitt11-Apr-13 23:32
Stephen Hewitt11-Apr-13 23:32 
GeneralRe: CoCreateInstance Problem & GetLastError 0x0000007e Pin
yihung.hung12-Apr-13 15:31
yihung.hung12-Apr-13 15:31 
GeneralRe: CoCreateInstance Problem & GetLastError 0x0000007e Pin
Stephen Hewitt12-Apr-13 19:11
Stephen Hewitt12-Apr-13 19:11 
GeneralRe: CoCreateInstance Problem & GetLastError 0x0000007e Pin
yihung.hung13-Apr-13 2:52
yihung.hung13-Apr-13 2:52 
GeneralRe: CoCreateInstance Problem & GetLastError 0x0000007e Pin
Richard MacCutchan12-Apr-13 22:00
mveRichard MacCutchan12-Apr-13 22:00 
Question[SOLVED] IHTMLDOCUMENT2 get_Script problem in thread Pin
mr_m_imran28-Mar-13 8:20
mr_m_imran28-Mar-13 8:20 
AnswerRe: IHTMLDOCUMENT2 get_Script problem in thread Pin
Richard MacCutchan28-Mar-13 8:48
mveRichard MacCutchan28-Mar-13 8:48 
GeneralRe: IHTMLDOCUMENT2 get_Script problem in thread Pin
mr_m_imran28-Mar-13 17:36
mr_m_imran28-Mar-13 17:36 
QuestionTo Identify .Net Dll's among many Dll's in a Project. Pin
Vishal_K8927-Mar-13 1:36
Vishal_K8927-Mar-13 1:36 
AnswerRe: To Identify .Net Dll's among many Dll's in a Project. Pin
Richard MacCutchan27-Mar-13 3:51
mveRichard MacCutchan27-Mar-13 3:51 
QuestionAdditional Include Directories Pin
bkelly1324-Mar-13 9:47
bkelly1324-Mar-13 9:47 
AnswerRe: Additional Include Directories Pin
Garth J Lancaster24-Mar-13 11:32
professionalGarth J Lancaster24-Mar-13 11:32 
GeneralRe: Additional Include Directories Pin
bkelly1324-Mar-13 12:15
bkelly1324-Mar-13 12:15 
GeneralRe: Additional Include Directories Pin
H.Brydon26-Mar-13 16:32
professionalH.Brydon26-Mar-13 16:32 
AnswerRe: Additional Include Directories Pin
dusty_dex24-Mar-13 11:41
dusty_dex24-Mar-13 11:41 
GeneralRe: Additional Include Directories Pin
bkelly1324-Mar-13 12:26
bkelly1324-Mar-13 12:26 
AnswerRe: Additional Include Directories Pin
SoMad24-Mar-13 13:26
professionalSoMad24-Mar-13 13:26 
GeneralRe: Additional Include Directories Pin
bkelly1324-Mar-13 13:47
bkelly1324-Mar-13 13:47 
GeneralRe: Additional Include Directories Pin
SoMad24-Mar-13 14:00
professionalSoMad24-Mar-13 14:00 
GeneralRe: Additional Include Directories Pin
bkelly1324-Mar-13 14:11
bkelly1324-Mar-13 14:11 
GeneralRe: Additional Include Directories Pin
SoMad24-Mar-13 14:40
professionalSoMad24-Mar-13 14:40 
AnswerRe: Additional Include Directories Pin
Richard MacCutchan24-Mar-13 23:37
mveRichard MacCutchan24-Mar-13 23:37 
GeneralRe: Additional Include Directories Pin
bkelly1325-Mar-13 16:14
bkelly1325-Mar-13 16:14 
GeneralRe: Additional Include Directories Pin
Richard MacCutchan25-Mar-13 23:41
mveRichard MacCutchan25-Mar-13 23:41 
Questionmemcpy, not understanding something Pin
bkelly1311-Mar-13 14:11
bkelly1311-Mar-13 14:11 
Windows 7, Visual Studio 2008, MFC, C++
A memset is not doing what I expect. Here is the relevant code. It is a received TCP/IP payload packet and the goal is to copy some of the data to a new location. m_carry_over_bytes has the expected value of 1200.

All the code surrounding the memcpy is just to look at the before and after.

C#
m_prev_header_packet_size     = mp_search_pointer->iads_structure.header.packet_size;
 m_prev_header_sequence_number = mp_search_pointer->iads_structure.header.sequence_number;
 m_prev_header_packets_sent    = mp_search_pointer->iads_structure.header.packets_sent;
 m_prev_header_packets_lost    = mp_search_pointer->iads_structure.header.loss_or_overflow;
 m_prev_header_dummy_0_5555    = mp_search_pointer->iads_structure.header.dummy[0];
 m_prev_header_dummy_1_6666    = mp_search_pointer->iads_structure.header.dummy[1];
 m_prev_header_dummy_2_7777    = mp_search_pointer->iads_structure.header.dummy[2];
 m_prev_header_dummy_3_ffff    = mp_search_pointer->iads_structure.header.dummy[3];


 memcpy( &m_carry_over_buffer,
         &mp_search_pointer,
         m_carry_over_bytes );

 m_curr_header_packet_size     = m_carry_over_buffer.iads_structure.header.packet_size;
 m_curr_header_sequence_number = m_carry_over_buffer.iads_structure.header.sequence_number;
 m_curr_header_packets_sent    = m_carry_over_buffer.iads_structure.header.packets_sent;
 m_curr_header_packets_lost    = m_carry_over_buffer.iads_structure.header.loss_or_overflow;
 m_curr_header_dummy_0_5555    = m_carry_over_buffer.iads_structure.header.dummy[0];
 m_curr_header_dummy_1_6666    = m_carry_over_buffer.iads_structure.header.dummy[1];
 m_curr_header_dummy_2_7777    = m_carry_over_buffer.iads_structure.header.dummy[2];
 m_curr_header_dummy_3_ffff    = m_carry_over_buffer.iads_structure.header.dummy[3];


Looking at the m_prev* variables I find the expected values: size is 1228, sequence_number is 62316, ... dummy 2 is 0x7777, etc

After the memcpy, the m_curr* values are expected to have the same values ad the m_prev* values. Instead they have all Fs, the value it was initialized to in the constructor.

Both the source and destination work back to this structure:
CSS
// 
  union RECEIVE_TYPE
  {
     char char_array [ C_TCP_MAX_RECEIVE_SIZE ];
     C_IADS_TD_FIXED_PARAMETER_PACKET iads_structure;
  } m_receive_buffer;



I expected this memcpy to be simple. Where am I not understanding it?
Thanks for your time
If you work with telemetry, please check this bulletin board: http://www.bkelly.ws/irig_106/


modified 11-Mar-13 20:47pm.

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.