title: Getting size of LPTSTR or CHAR* containing hex values
body: <p>I'm trying to get the size of an LPTSTR variable and a CONST CHAR variable using the below code, but I'm not able to get the proper size.</p>
  
  <p>I'm supposed to get 20, but instead I'm getting 0 for the const char* variable and 4 for the LPTSTR variable.</p>
  
  <pre><code>const char *var1 =  "\x00\x00\x00\x00"
                      "\x00\x00\x00\x00"
                      "\x02\x00\x00\x00"
                      "\x5B\xE0\x5B\xE0"
                      "\x00\x00\x00\x00";
  
  LPTSTR var2 =       "\x00\x00\x00\x00"
                      "\x00\x00\x00\x00"
                      "\x02\x00\x00\x00"
                      "\x5B\xE0\x5B\xE0"
                      "\x00\x00\x00\x00";
  
  printf("%d",  sizeof(var1));  // this outputs 0
  printf("%d",  sizeof(var2));  // this outputs 4
  </code></pre>
  
  <p>I need to get the size of the value to insert it into the Windows Registry as binary data (<code>REG_BINARY</code>) using the following function:</p>
  
  <pre><code>lRes = RegSetValueEx(hMykey, "Scancode Map", 0, REG_BINARY, (LPBYTE) var2, sizeof(var2));
  </code></pre>