ReactOS  0.4.14-dev-604-gcfdd483
stringtable.c File Reference
#include "setupapi_private.h"
Include dependency graph for stringtable.c:

Go to the source code of this file.

Classes

struct  _TABLE_SLOT
 
struct  _STRING_TABLE
 

Macros

#define TABLE_DEFAULT_SIZE   256
 

Typedefs

typedef struct _TABLE_SLOT TABLE_SLOT
 
typedef struct _TABLE_SLOTPTABLE_SLOT
 
typedef struct _STRING_TABLE STRING_TABLE
 
typedef struct _STRING_TABLEPSTRING_TABLE
 

Functions

HSTRING_TABLE WINAPI pSetupStringTableInitialize (VOID)
 
HSTRING_TABLE WINAPI pSetupStringTableInitializeEx (DWORD dwMaxExtraDataSize, DWORD dwReserved)
 
VOID WINAPI pSetupStringTableDestroy (HSTRING_TABLE hStringTable)
 
DWORD WINAPI pSetupStringTableAddString (HSTRING_TABLE hStringTable, LPWSTR lpString, DWORD dwFlags)
 
DWORD WINAPI pSetupStringTableAddStringEx (HSTRING_TABLE hStringTable, LPWSTR lpString, DWORD dwFlags, LPVOID lpExtraData, DWORD dwExtraDataSize)
 
HSTRING_TABLE WINAPI pSetupStringTableDuplicate (HSTRING_TABLE hStringTable)
 
BOOL WINAPI pSetupStringTableGetExtraData (HSTRING_TABLE hStringTable, DWORD dwId, LPVOID lpExtraData, DWORD dwExtraDataSize)
 
DWORD WINAPI pSetupStringTableLookUpString (HSTRING_TABLE hStringTable, LPWSTR lpString, DWORD dwFlags)
 
DWORD WINAPI pSetupStringTableLookUpStringEx (HSTRING_TABLE hStringTable, LPWSTR lpString, DWORD dwFlags, LPVOID lpExtraData, DWORD dwReserved)
 
BOOL WINAPI pSetupStringTableSetExtraData (HSTRING_TABLE hStringTable, DWORD dwId, LPVOID lpExtraData, DWORD dwExtraDataSize)
 
LPWSTR WINAPI pSetupStringTableStringFromId (HSTRING_TABLE hStringTable, DWORD dwId)
 
BOOL WINAPI pSetupStringTableStringFromIdEx (HSTRING_TABLE hStringTable, DWORD dwId, LPWSTR lpBuffer, LPDWORD lpBufferLength)
 

Macro Definition Documentation

◆ TABLE_DEFAULT_SIZE

#define TABLE_DEFAULT_SIZE   256

Definition at line 23 of file stringtable.c.

Typedef Documentation

◆ PSTRING_TABLE

◆ PTABLE_SLOT

◆ STRING_TABLE

◆ TABLE_SLOT

Function Documentation

◆ pSetupStringTableAddString()

DWORD WINAPI pSetupStringTableAddString ( HSTRING_TABLE  hStringTable,
LPWSTR  lpString,
DWORD  dwFlags 
)

Definition at line 196 of file stringtable.c.

199 {
200  PSTRING_TABLE pStringTable;
201  DWORD i;
202 
203  TRACE("%p %s %x\n", hStringTable, debugstr_w(lpString), dwFlags);
204 
205  pStringTable = (PSTRING_TABLE)hStringTable;
206  if (pStringTable == NULL)
207  {
208  ERR("Invalid hStringTable!\n");
209  return (DWORD)-1;
210  }
211 
212  /* Search for existing string in the string table */
213  for (i = 0; i < pStringTable->dwMaxSlots; i++)
214  {
215  if (pStringTable->pSlots[i].pString != NULL)
216  {
217  if (dwFlags & 1)
218  {
219  if (!lstrcmpW(pStringTable->pSlots[i].pString, lpString))
220  {
221  return i + 1;
222  }
223  }
224  else
225  {
226  if (!lstrcmpiW(pStringTable->pSlots[i].pString, lpString))
227  {
228  return i + 1;
229  }
230  }
231  }
232  }
233 
234  /* Check for filled slot table */
235  if (pStringTable->dwUsedSlots == pStringTable->dwMaxSlots)
236  {
237  PTABLE_SLOT pNewSlots;
238  DWORD dwNewMaxSlots;
239 
240  /* FIXME: not thread safe */
241  dwNewMaxSlots = pStringTable->dwMaxSlots * 2;
242  pNewSlots = MyMalloc(sizeof(TABLE_SLOT) * dwNewMaxSlots);
243  if (pNewSlots == NULL)
244  return (DWORD)-1;
245  memset(&pNewSlots[pStringTable->dwMaxSlots], 0, sizeof(TABLE_SLOT) * (dwNewMaxSlots - pStringTable->dwMaxSlots));
246  memcpy(pNewSlots, pStringTable->pSlots, sizeof(TABLE_SLOT) * pStringTable->dwMaxSlots);
247  pNewSlots = InterlockedExchangePointer((PVOID*)&pStringTable->pSlots, pNewSlots);
248  MyFree(pNewSlots);
249  pStringTable->dwMaxSlots = dwNewMaxSlots;
250 
251  return pSetupStringTableAddString(hStringTable, lpString, dwFlags);
252  }
253 
254  /* Search for an empty slot */
255  for (i = 0; i < pStringTable->dwMaxSlots; i++)
256  {
257  if (pStringTable->pSlots[i].pString == NULL)
258  {
259  pStringTable->pSlots[i].pString = MyMalloc((lstrlenW(lpString) + 1) * sizeof(WCHAR));
260  if (pStringTable->pSlots[i].pString == NULL)
261  {
262  TRACE("Couldn't allocate memory for a new string!\n");
263  return (DWORD)-1;
264  }
265 
266  lstrcpyW(pStringTable->pSlots[i].pString, lpString);
267 
268  pStringTable->dwUsedSlots++;
269 
270  return i + 1;
271  }
272  }
273 
274  TRACE("Couldn't find an empty slot!\n");
275 
276  return (DWORD)-1;
277 }
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
DWORD dwMaxSlots
Definition: stringtable.c:36
#define lstrlenW
Definition: compat.h:415
struct _STRING_TABLE * PSTRING_TABLE
int WINAPI lstrcmpiW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:194
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
LPWSTR pString
Definition: stringtable.c:27
DWORD WINAPI pSetupStringTableAddString(HSTRING_TABLE hStringTable, LPWSTR lpString, DWORD dwFlags)
Definition: stringtable.c:196
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedExchangePointer(Target, Value)
Definition: dshow.h:45
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD dwUsedSlots
Definition: stringtable.c:35
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define ERR(fmt,...)
Definition: debug.h:109
#define lstrcpyW
Definition: compat.h:414
LPVOID WINAPI MyMalloc(DWORD dwSize)
Definition: misc.c:147
#define memset(x, y, z)
Definition: compat.h:39
VOID WINAPI MyFree(LPVOID lpMem)
Definition: misc.c:128
PTABLE_SLOT pSlots
Definition: stringtable.c:34

Referenced by CM_Connect_MachineW(), CM_Create_DevNode_ExW(), CM_Get_Child_Ex(), CM_Get_Parent_Ex(), CM_Get_Sibling_Ex(), CM_Locate_DevNode_ExW(), PnpGetLocalHandles(), and pSetupStringTableAddString().

◆ pSetupStringTableAddStringEx()

DWORD WINAPI pSetupStringTableAddStringEx ( HSTRING_TABLE  hStringTable,
LPWSTR  lpString,
DWORD  dwFlags,
LPVOID  lpExtraData,
DWORD  dwExtraDataSize 
)

Definition at line 303 of file stringtable.c.

308 {
309  PSTRING_TABLE pStringTable;
310  DWORD i;
311 
312  TRACE("%p %s %lx\n", (PVOID)hStringTable, debugstr_w(lpString), dwFlags);
313 
314  pStringTable = (PSTRING_TABLE)hStringTable;
315  if (pStringTable == NULL)
316  {
317  ERR("Invalid hStringTable!\n");
318  return (DWORD)-1;
319  }
320 
321  /* Search for existing string in the string table */
322  for (i = 0; i < pStringTable->dwMaxSlots; i++)
323  {
324  if (pStringTable->pSlots[i].pString != NULL)
325  {
326  if (dwFlags & 1)
327  {
328  if (!lstrcmpW(pStringTable->pSlots[i].pString, lpString))
329  {
330  return i + 1;
331  }
332  }
333  else
334  {
335  if (!lstrcmpiW(pStringTable->pSlots[i].pString, lpString))
336  {
337  return i + 1;
338  }
339  }
340  }
341  }
342 
343  /* Check for filled slot table */
344  if (pStringTable->dwUsedSlots == pStringTable->dwMaxSlots)
345  {
346  FIXME("Resize the string table!\n");
347  return (DWORD)-1;
348  }
349 
350  /* Search for an empty slot */
351  for (i = 0; i < pStringTable->dwMaxSlots; i++)
352  {
353  if (pStringTable->pSlots[i].pString == NULL)
354  {
355  pStringTable->pSlots[i].pString = MyMalloc((lstrlenW(lpString) + 1) * sizeof(WCHAR));
356  if (pStringTable->pSlots[i].pString == NULL)
357  {
358  TRACE("Couldn't allocate memory for a new string!\n");
359  return (DWORD)-1;
360  }
361 
362  lstrcpyW(pStringTable->pSlots[i].pString, lpString);
363 
364  pStringTable->pSlots[i].pData = MyMalloc(dwExtraDataSize);
365  if (pStringTable->pSlots[i].pData == NULL)
366  {
367  TRACE("Couldn't allocate memory for a new extra data!\n");
368  MyFree(pStringTable->pSlots[i].pString);
369  pStringTable->pSlots[i].pString = NULL;
370  return (DWORD)-1;
371  }
372 
373  memcpy(pStringTable->pSlots[i].pData,
374  lpExtraData,
375  dwExtraDataSize);
376  pStringTable->pSlots[i].dwSize = dwExtraDataSize;
377 
378  pStringTable->dwUsedSlots++;
379 
380  return i + 1;
381  }
382  }
383 
384  TRACE("Couldn't find an empty slot!\n");
385 
386  return (DWORD)-1;
387 }
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
DWORD dwMaxSlots
Definition: stringtable.c:36
#define lstrlenW
Definition: compat.h:415
struct _STRING_TABLE * PSTRING_TABLE
int WINAPI lstrcmpiW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:194
LPVOID pData
Definition: stringtable.c:28
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
DWORD dwSize
Definition: stringtable.c:29
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
LPWSTR pString
Definition: stringtable.c:27
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD dwUsedSlots
Definition: stringtable.c:35
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define ERR(fmt,...)
Definition: debug.h:109
#define lstrcpyW
Definition: compat.h:414
LPVOID WINAPI MyMalloc(DWORD dwSize)
Definition: misc.c:147
VOID WINAPI MyFree(LPVOID lpMem)
Definition: misc.c:128
PTABLE_SLOT pSlots
Definition: stringtable.c:34

◆ pSetupStringTableDestroy()

VOID WINAPI pSetupStringTableDestroy ( HSTRING_TABLE  hStringTable)

Definition at line 145 of file stringtable.c.

146 {
147  PSTRING_TABLE pStringTable;
148  DWORD i;
149 
150  TRACE("%p\n", hStringTable);
151 
152  pStringTable = (PSTRING_TABLE)hStringTable;
153  if (pStringTable == NULL)
154  return;
155 
156  if (pStringTable->pSlots != NULL)
157  {
158  for (i = 0; i < pStringTable->dwMaxSlots; i++)
159  {
160  MyFree(pStringTable->pSlots[i].pString);
161  pStringTable->pSlots[i].pString = NULL;
162 
163  MyFree(pStringTable->pSlots[i].pData);
164  pStringTable->pSlots[i].pData = NULL;
165  pStringTable->pSlots[i].dwSize = 0;
166  }
167 
168  MyFree(pStringTable->pSlots);
169  }
170 
171  MyFree(pStringTable);
172 }
DWORD dwMaxSlots
Definition: stringtable.c:36
struct _STRING_TABLE * PSTRING_TABLE
LPVOID pData
Definition: stringtable.c:28
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
DWORD dwSize
Definition: stringtable.c:29
smooth NULL
Definition: ftsmooth.c:416
LPWSTR pString
Definition: stringtable.c:27
#define TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95
VOID WINAPI MyFree(LPVOID lpMem)
Definition: misc.c:128
PTABLE_SLOT pSlots
Definition: stringtable.c:34

Referenced by CM_Connect_MachineW(), CM_Disconnect_Machine(), PnpGetLocalHandles(), and PnpUnbindLocalBindingHandle().

◆ pSetupStringTableDuplicate()

HSTRING_TABLE WINAPI pSetupStringTableDuplicate ( HSTRING_TABLE  hStringTable)

Definition at line 404 of file stringtable.c.

405 {
406  PSTRING_TABLE pSourceTable;
407  PSTRING_TABLE pDestinationTable;
408  DWORD i;
409  DWORD length;
410 
411  TRACE("%p\n", hStringTable);
412 
413  pSourceTable = (PSTRING_TABLE)hStringTable;
414  if (pSourceTable == NULL)
415  {
416  ERR("Invalid hStringTable!\n");
417  return (HSTRING_TABLE)NULL;
418  }
419 
420  pDestinationTable = MyMalloc(sizeof(STRING_TABLE));
421  if (pDestinationTable == NULL)
422  {
423  ERR("Could not allocate a new string table!\n");
424  return (HSTRING_TABLE)NULL;
425  }
426 
427  memset(pDestinationTable, 0, sizeof(STRING_TABLE));
428 
429  pDestinationTable->pSlots = MyMalloc(sizeof(TABLE_SLOT) * pSourceTable->dwMaxSlots);
430  if (pDestinationTable->pSlots == NULL)
431  {
432  MyFree(pDestinationTable);
433  return (HSTRING_TABLE)NULL;
434  }
435 
436  memset(pDestinationTable->pSlots, 0, sizeof(TABLE_SLOT) * pSourceTable->dwMaxSlots);
437 
438  pDestinationTable->dwUsedSlots = 0;
439  pDestinationTable->dwMaxSlots = pSourceTable->dwMaxSlots;
440 
441  for (i = 0; i < pSourceTable->dwMaxSlots; i++)
442  {
443  if (pSourceTable->pSlots[i].pString != NULL)
444  {
445  length = (lstrlenW(pSourceTable->pSlots[i].pString) + 1) * sizeof(WCHAR);
446  pDestinationTable->pSlots[i].pString = MyMalloc(length);
447  if (pDestinationTable->pSlots[i].pString != NULL)
448  {
449  memcpy(pDestinationTable->pSlots[i].pString,
450  pSourceTable->pSlots[i].pString,
451  length);
452  pDestinationTable->dwUsedSlots++;
453  }
454 
455  if (pSourceTable->pSlots[i].pData != NULL)
456  {
457  length = pSourceTable->pSlots[i].dwSize;
458  pDestinationTable->pSlots[i].pData = MyMalloc(length);
459  if (pDestinationTable->pSlots[i].pData)
460  {
461  memcpy(pDestinationTable->pSlots[i].pData,
462  pSourceTable->pSlots[i].pData,
463  length);
464  pDestinationTable->pSlots[i].dwSize = length;
465  }
466  }
467  }
468  }
469 
470  return (HSTRING_TABLE)pDestinationTable;
471 }
DWORD dwMaxSlots
Definition: stringtable.c:36
#define lstrlenW
Definition: compat.h:415
struct _STRING_TABLE * PSTRING_TABLE
LPVOID pData
Definition: stringtable.c:28
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
DWORD dwSize
Definition: stringtable.c:29
smooth NULL
Definition: ftsmooth.c:416
LPWSTR pString
Definition: stringtable.c:27
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD dwUsedSlots
Definition: stringtable.c:35
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define ERR(fmt,...)
Definition: debug.h:109
LPVOID WINAPI MyMalloc(DWORD dwSize)
Definition: misc.c:147
#define memset(x, y, z)
Definition: compat.h:39
VOID WINAPI MyFree(LPVOID lpMem)
Definition: misc.c:128
PTABLE_SLOT pSlots
Definition: stringtable.c:34

◆ pSetupStringTableGetExtraData()

BOOL WINAPI pSetupStringTableGetExtraData ( HSTRING_TABLE  hStringTable,
DWORD  dwId,
LPVOID  lpExtraData,
DWORD  dwExtraDataSize 
)

Definition at line 490 of file stringtable.c.

494 {
495  PSTRING_TABLE pStringTable;
496 
497  TRACE("%p %x %p %u\n",
498  hStringTable, dwId, lpExtraData, dwExtraDataSize);
499 
500  pStringTable = (PSTRING_TABLE)hStringTable;
501  if (pStringTable == NULL)
502  {
503  ERR("Invalid hStringTable!\n");
504  return FALSE;
505  }
506 
507  if (dwId == 0 || dwId > pStringTable->dwMaxSlots)
508  {
509  ERR("Invalid Slot id!\n");
510  return FALSE;
511  }
512 
513  if (pStringTable->pSlots[dwId - 1].dwSize < dwExtraDataSize)
514  {
515  ERR("Data size is too large!\n");
516  return FALSE;
517  }
518 
519  memcpy(lpExtraData,
520  pStringTable->pSlots[dwId - 1].pData,
521  dwExtraDataSize);
522 
523  return TRUE;
524 }
#define TRUE
Definition: types.h:120
DWORD dwMaxSlots
Definition: stringtable.c:36
struct _STRING_TABLE * PSTRING_TABLE
LPVOID pData
Definition: stringtable.c:28
DWORD dwSize
Definition: stringtable.c:29
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define ERR(fmt,...)
Definition: debug.h:109
PTABLE_SLOT pSlots
Definition: stringtable.c:34

◆ pSetupStringTableInitialize()

HSTRING_TABLE WINAPI pSetupStringTableInitialize ( VOID  )

Definition at line 54 of file stringtable.c.

55 {
56  PSTRING_TABLE pStringTable;
57 
58  TRACE("\n");
59 
60  pStringTable = MyMalloc(sizeof(STRING_TABLE));
61  if (pStringTable == NULL)
62  {
63  ERR("Invalid hStringTable!\n");
64  return NULL;
65  }
66 
67  memset(pStringTable, 0, sizeof(STRING_TABLE));
68 
69  pStringTable->pSlots = MyMalloc(sizeof(TABLE_SLOT) * TABLE_DEFAULT_SIZE);
70  if (pStringTable->pSlots == NULL)
71  {
72  MyFree(pStringTable);
73  return NULL;
74  }
75 
76  memset(pStringTable->pSlots, 0, sizeof(TABLE_SLOT) * TABLE_DEFAULT_SIZE);
77 
78  pStringTable->dwUsedSlots = 0;
79  pStringTable->dwMaxSlots = TABLE_DEFAULT_SIZE;
80  pStringTable->dwMaxDataSize = 0;
81 
82  TRACE("Done\n");
83 
84  return (HSTRING_TABLE)pStringTable;
85 }
#define TABLE_DEFAULT_SIZE
Definition: stringtable.c:23
DWORD dwMaxDataSize
Definition: stringtable.c:37
DWORD dwMaxSlots
Definition: stringtable.c:36
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
DWORD dwUsedSlots
Definition: stringtable.c:35
#define ERR(fmt,...)
Definition: debug.h:109
LPVOID WINAPI MyMalloc(DWORD dwSize)
Definition: misc.c:147
#define memset(x, y, z)
Definition: compat.h:39
VOID WINAPI MyFree(LPVOID lpMem)
Definition: misc.c:128
PTABLE_SLOT pSlots
Definition: stringtable.c:34

Referenced by CM_Connect_MachineW(), and PnpGetLocalHandles().

◆ pSetupStringTableInitializeEx()

HSTRING_TABLE WINAPI pSetupStringTableInitializeEx ( DWORD  dwMaxExtraDataSize,
DWORD  dwReserved 
)

Definition at line 102 of file stringtable.c.

104 {
105  PSTRING_TABLE pStringTable;
106 
107  TRACE("\n");
108 
109  pStringTable = MyMalloc(sizeof(STRING_TABLE));
110  if (pStringTable == NULL) return NULL;
111 
112  memset(pStringTable, 0, sizeof(STRING_TABLE));
113 
114  pStringTable->pSlots = MyMalloc(sizeof(TABLE_SLOT) * TABLE_DEFAULT_SIZE);
115  if (pStringTable->pSlots == NULL)
116  {
117  MyFree(pStringTable);
118  return NULL;
119  }
120 
121  memset(pStringTable->pSlots, 0, sizeof(TABLE_SLOT) * TABLE_DEFAULT_SIZE);
122 
123  pStringTable->dwUsedSlots = 0;
124  pStringTable->dwMaxSlots = TABLE_DEFAULT_SIZE;
125  pStringTable->dwMaxDataSize = dwMaxExtraDataSize;
126 
127  TRACE("Done\n");
128 
129  return (HSTRING_TABLE)pStringTable;
130 }
#define TABLE_DEFAULT_SIZE
Definition: stringtable.c:23
DWORD dwMaxDataSize
Definition: stringtable.c:37
DWORD dwMaxSlots
Definition: stringtable.c:36
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
DWORD dwUsedSlots
Definition: stringtable.c:35
LPVOID WINAPI MyMalloc(DWORD dwSize)
Definition: misc.c:147
#define memset(x, y, z)
Definition: compat.h:39
VOID WINAPI MyFree(LPVOID lpMem)
Definition: misc.c:128
PTABLE_SLOT pSlots
Definition: stringtable.c:34

◆ pSetupStringTableLookUpString()

DWORD WINAPI pSetupStringTableLookUpString ( HSTRING_TABLE  hStringTable,
LPWSTR  lpString,
DWORD  dwFlags 
)

Definition at line 543 of file stringtable.c.

546 {
547  PSTRING_TABLE pStringTable;
548  DWORD i;
549 
550  TRACE("%p %s %x\n", hStringTable, debugstr_w(lpString), dwFlags);
551 
552  pStringTable = (PSTRING_TABLE)hStringTable;
553  if (pStringTable == NULL)
554  {
555  ERR("Invalid hStringTable!\n");
556  return (DWORD)-1;
557  }
558 
559  /* Search for existing string in the string table */
560  for (i = 0; i < pStringTable->dwMaxSlots; i++)
561  {
562  if (pStringTable->pSlots[i].pString != NULL)
563  {
564  if (dwFlags & 1)
565  {
566  if (!lstrcmpW(pStringTable->pSlots[i].pString, lpString))
567  return i + 1;
568  }
569  else
570  {
571  if (!lstrcmpiW(pStringTable->pSlots[i].pString, lpString))
572  return i + 1;
573  }
574  }
575  }
576 
577  return (DWORD)-1;
578 }
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
DWORD dwMaxSlots
Definition: stringtable.c:36
struct _STRING_TABLE * PSTRING_TABLE
int WINAPI lstrcmpiW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:194
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
LPWSTR pString
Definition: stringtable.c:27
#define TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define ERR(fmt,...)
Definition: debug.h:109
PTABLE_SLOT pSlots
Definition: stringtable.c:34

◆ pSetupStringTableLookUpStringEx()

DWORD WINAPI pSetupStringTableLookUpStringEx ( HSTRING_TABLE  hStringTable,
LPWSTR  lpString,
DWORD  dwFlags,
LPVOID  lpExtraData,
DWORD  dwReserved 
)

Definition at line 599 of file stringtable.c.

604 {
605  PSTRING_TABLE pStringTable;
606  DWORD i;
607 
608  TRACE("%p %s %x %p, %x\n", hStringTable, debugstr_w(lpString), dwFlags,
609  lpExtraData, dwReserved);
610 
611  pStringTable = (PSTRING_TABLE)hStringTable;
612  if (pStringTable == NULL)
613  {
614  ERR("Invalid hStringTable!\n");
615  return ~0u;
616  }
617 
618  /* Search for existing string in the string table */
619  for (i = 0; i < pStringTable->dwMaxSlots; i++)
620  {
621  if (pStringTable->pSlots[i].pString != NULL)
622  {
623  if (dwFlags & 1)
624  {
625  if (!lstrcmpW(pStringTable->pSlots[i].pString, lpString))
626  {
627  if (lpExtraData)
628  memcpy(lpExtraData, pStringTable->pSlots[i].pData, dwReserved);
629  return i + 1;
630  }
631  }
632  else
633  {
634  if (!lstrcmpiW(pStringTable->pSlots[i].pString, lpString))
635  {
636  if (lpExtraData)
637  memcpy(lpExtraData, pStringTable->pSlots[i].pData, dwReserved);
638  return i + 1;
639  }
640  }
641  }
642  }
643  return ~0u;
644 }
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
DWORD dwMaxSlots
Definition: stringtable.c:36
struct _STRING_TABLE * PSTRING_TABLE
int WINAPI lstrcmpiW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:194
LPVOID pData
Definition: stringtable.c:28
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
_In_ HANDLE _In_ DWORD _In_ DWORD _Inout_opt_ LPOVERLAPPED _In_opt_ LPTRANSMIT_FILE_BUFFERS _In_ DWORD dwReserved
Definition: mswsock.h:90
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
LPWSTR pString
Definition: stringtable.c:27
#define TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define ERR(fmt,...)
Definition: debug.h:109
PTABLE_SLOT pSlots
Definition: stringtable.c:34

◆ pSetupStringTableSetExtraData()

BOOL WINAPI pSetupStringTableSetExtraData ( HSTRING_TABLE  hStringTable,
DWORD  dwId,
LPVOID  lpExtraData,
DWORD  dwExtraDataSize 
)

Definition at line 663 of file stringtable.c.

667 {
668  PSTRING_TABLE pStringTable;
669 
670  TRACE("%p %x %p %u\n",
671  hStringTable, dwId, lpExtraData, dwExtraDataSize);
672 
673  pStringTable = (PSTRING_TABLE)hStringTable;
674  if (pStringTable == NULL)
675  {
676  ERR("Invalid hStringTable!\n");
677  return FALSE;
678  }
679 
680  if (dwId == 0 || dwId > pStringTable->dwMaxSlots)
681  {
682  ERR("Invalid Slot id!\n");
683  return FALSE;
684  }
685 
686  if (pStringTable->dwMaxDataSize < dwExtraDataSize)
687  {
688  ERR("Data size is too large!\n");
689  return FALSE;
690  }
691 
692  pStringTable->pSlots[dwId - 1].pData = MyMalloc(dwExtraDataSize);
693  if (pStringTable->pSlots[dwId - 1].pData == NULL)
694  {
695  ERR("\n");
696  return FALSE;
697  }
698 
699  memcpy(pStringTable->pSlots[dwId - 1].pData,
700  lpExtraData,
701  dwExtraDataSize);
702  pStringTable->pSlots[dwId - 1].dwSize = dwExtraDataSize;
703 
704  return TRUE;
705 }
#define TRUE
Definition: types.h:120
DWORD dwMaxDataSize
Definition: stringtable.c:37
DWORD dwMaxSlots
Definition: stringtable.c:36
struct _STRING_TABLE * PSTRING_TABLE
LPVOID pData
Definition: stringtable.c:28
DWORD dwSize
Definition: stringtable.c:29
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define ERR(fmt,...)
Definition: debug.h:109
LPVOID WINAPI MyMalloc(DWORD dwSize)
Definition: misc.c:147
PTABLE_SLOT pSlots
Definition: stringtable.c:34

◆ pSetupStringTableStringFromId()

LPWSTR WINAPI pSetupStringTableStringFromId ( HSTRING_TABLE  hStringTable,
DWORD  dwId 
)

Definition at line 722 of file stringtable.c.

724 {
725  PSTRING_TABLE pStringTable;
726  static WCHAR empty[] = {0};
727 
728  TRACE("%p %x\n", hStringTable, dwId);
729 
730  pStringTable = (PSTRING_TABLE)hStringTable;
731  if (pStringTable == NULL)
732  {
733  ERR("Invalid hStringTable!\n");
734  return NULL;
735  }
736 
737  if (dwId == 0 || dwId > pStringTable->dwMaxSlots)
738  return empty;
739 
740  return pStringTable->pSlots[dwId - 1].pString;
741 }
DWORD dwMaxSlots
Definition: stringtable.c:36
struct _STRING_TABLE * PSTRING_TABLE
smooth NULL
Definition: ftsmooth.c:416
LPWSTR pString
Definition: stringtable.c:27
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define ERR(fmt,...)
Definition: debug.h:109
BOOL empty
Definition: button.c:170
PTABLE_SLOT pSlots
Definition: stringtable.c:34

Referenced by CM_Add_Empty_Log_Conf_Ex(), CM_Add_ID_ExW(), CM_Create_DevNode_ExW(), CM_Delete_DevNode_Key_Ex(), CM_Disable_DevNode_Ex(), CM_Enable_DevNode_Ex(), CM_Free_Log_Conf_Ex(), CM_Get_Child_Ex(), CM_Get_Depth_Ex(), CM_Get_Device_ID_Size_Ex(), CM_Get_DevNode_Custom_Property_ExW(), CM_Get_DevNode_Registry_Property_ExW(), CM_Get_DevNode_Status_Ex(), CM_Get_First_Log_Conf_Ex(), CM_Get_Log_Conf_Priority_Ex(), CM_Get_Next_Log_Conf_Ex(), CM_Get_Parent_Ex(), CM_Get_Sibling_Ex(), CM_Move_DevNode_Ex(), CM_Open_DevNode_Key_Ex(), CM_Query_And_Remove_SubTree_ExW(), CM_Query_Arbitrator_Free_Data_Ex(), CM_Query_Arbitrator_Free_Size_Ex(), CM_Query_Resource_Conflict_List(), CM_Reenumerate_DevNode_Ex(), CM_Register_Device_Driver_Ex(), CM_Register_Device_Interface_ExW(), CM_Request_Device_Eject_ExW(), CM_Set_DevNode_Problem_Ex(), CM_Set_DevNode_Registry_Property_ExW(), CM_Setup_DevNode_Ex(), and CM_Uninstall_DevNode_Ex().

◆ pSetupStringTableStringFromIdEx()

BOOL WINAPI pSetupStringTableStringFromIdEx ( HSTRING_TABLE  hStringTable,
DWORD  dwId,
LPWSTR  lpBuffer,
LPDWORD  lpBufferLength 
)

Definition at line 760 of file stringtable.c.

764 {
765  PSTRING_TABLE pStringTable;
766  DWORD dwLength;
767  BOOL bResult = FALSE;
768 
769  TRACE("%p %x %p %p\n", hStringTable, dwId, lpBuffer, lpBufferLength);
770 
771  pStringTable = (PSTRING_TABLE)hStringTable;
772  if (pStringTable == NULL)
773  {
774  ERR("Invalid hStringTable!\n");
775  *lpBufferLength = 0;
776  return FALSE;
777  }
778 
779  if (dwId == 0 || dwId > pStringTable->dwMaxSlots ||
780  pStringTable->pSlots[dwId - 1].pString == NULL)
781  {
782  WARN("Invalid string ID!\n");
783  *lpBufferLength = 0;
784  return FALSE;
785  }
786 
787  dwLength = (lstrlenW(pStringTable->pSlots[dwId - 1].pString) + 1);
788  if (dwLength <= *lpBufferLength)
789  {
790  lstrcpyW(lpBuffer, pStringTable->pSlots[dwId - 1].pString);
791  bResult = TRUE;
792  }
793 
794  *lpBufferLength = dwLength;
795 
796  return bResult;
797 }
#define TRUE
Definition: types.h:120
#define WARN(fmt,...)
Definition: debug.h:111
DWORD dwMaxSlots
Definition: stringtable.c:36
#define lstrlenW
Definition: compat.h:415
struct _STRING_TABLE * PSTRING_TABLE
unsigned int BOOL
Definition: ntddk_ex.h:94
static TAGREF LPCWSTR LPDWORD LPVOID lpBuffer
Definition: db.cpp:173
smooth NULL
Definition: ftsmooth.c:416
LPWSTR pString
Definition: stringtable.c:27
#define TRACE(s)
Definition: solgame.cpp:4
static DWORD DWORD * dwLength
Definition: fusion.c:85
unsigned long DWORD
Definition: ntddk_ex.h:95
#define ERR(fmt,...)
Definition: debug.h:109
#define lstrcpyW
Definition: compat.h:414
PTABLE_SLOT pSlots
Definition: stringtable.c:34

Referenced by CM_Get_Device_ID_ExW().