Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 455
  • Last Modified:

DWORD interpretation problem

I am using VC 4.0, Win95, and doing some coding that uses TAPI functions.  I have a callback function (LineCallBack in TAPI) that has 3 generic DWORD params passed to it.  I have no problem receiving these values and using them except when one of the values is supposed to point to a string.  In this case the value I receive is huge and is pointing to nowhere. (I might point out that the values are being sent to my callback from some unknown lower level functions supplied in a DLL as part of an SDK.)

After reading the definition of DWORD, which says:  a 32-bit uint OR "address of a segment and its associated offset" I decided that my problem might be that, in this case, DWORD means the latter (isn't this 16-bit addressing? why?).  I need to know how to interpret this value so that I can find my string.

I hope this is enough info... thanks for any help.

0
tberrier
Asked:
tberrier
1 Solution
 
jw011697Commented:
In 32 bit land, a DWORD can act as a normal pointer as there are no segments used in addressing, just a 32 bit offset.

In this case you should just cast the DWORD as (char *) and it will work fine as a string.

When you say 'pointing to nowhere', what do you exactly mean?

I just checked through all the TAPI replies that could be sent to this LineCallback function and couldn't find any that provide a string (this is fairly unusual for callbacks as strings require memory to be allocated for the purpose).

Try looking at the Line Device Message again and make sure you have the interpretation of the parameters correct?
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now