1 Replies - 7126 Views - Last Post: 30 November 2009 - 12:16 PM Rate Topic: -----

#1 (none)  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 76
  • Joined: 30-September 09

PUCHAR and DWORD

Posted 30 November 2009 - 11:35 AM

Hi.

I only need some help with one of the following.

If I have

INT function(PDWORD pdwBuffer)
{
pdwBuffer = 2;
return some_other_value;
}


How do I set pdwBuffer to equal 2? (an int.)

Or.

How do I copy a INT to a PUCHAR (unsigned char*) and a PUCHAR to a INT?

Thanks.

**Mod Edit: Added code tags**

This post has been edited by OliveOyl3471: 30 November 2009 - 11:53 AM

Is This A Good Question/Topic? 0
  • +

Replies To: PUCHAR and DWORD

#2 NickDMax  Icon User is offline

  • Can grep dead trees!
  • member icon

Reputation: 2250
  • View blog
  • Posts: 9,245
  • Joined: 18-February 07

Re: PUCHAR and DWORD

Posted 30 November 2009 - 12:16 PM

Well I have no idea what you are talking about but lets see what I can do:

PDWORD -- is a pointer to a 32 bit integer. it should be an alias for: long int *

You would not want to set a pointer to the value of 2 -- because that would probably result in an access violation and crash the program.

so you could do something like *pdwBuffer = 2; or pdwBuffer[0] = 2;

as for putting an int into a PUCHAR -- well an integer (16 or 32 bit value) will not fit into a char, unless the value is between 0 - 255. Then again all you need to do is cast the int and use a dereference operator to store the value.
Was This Post Helpful? 1

Page 1 of 1