ReactOS  0.4.14-dev-297-g23e575c
table.c File Reference
#include "config.h"
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "wbemcli.h"
#include "wine/debug.h"
#include "wbemprox_private.h"
Include dependency graph for table.c:

Go to the source code of this file.

Macros

#define COBJMACROS
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (wbemprox)
 
HRESULT get_column_index (const struct table *table, const WCHAR *name, UINT *column)
 
UINT get_type_size (CIMTYPE type)
 
static UINT get_column_size (const struct table *table, UINT column)
 
static UINT get_column_offset (const struct table *table, UINT column)
 
static UINT get_row_size (const struct table *table)
 
HRESULT get_value (const struct table *table, UINT row, UINT column, LONGLONG *val)
 
BSTR get_value_bstr (const struct table *table, UINT row, UINT column)
 
HRESULT set_value (const struct table *table, UINT row, UINT column, LONGLONG val, CIMTYPE type)
 
HRESULT get_method (const struct table *table, const WCHAR *name, class_method **func)
 
void free_row_values (const struct table *table, UINT row)
 
void clear_table (struct table *table)
 
void free_columns (struct column *columns, UINT num_cols)
 
void free_table (struct table *table)
 
void release_table (struct table *table)
 
struct tableaddref_table (struct table *table)
 
struct tablegrab_table (const WCHAR *name)
 
struct tablecreate_table (const WCHAR *name, UINT num_cols, const struct column *columns, UINT num_rows, UINT num_allocated, BYTE *data, enum fill_status(*fill)(struct table *, const struct expr *cond))
 
BOOL add_table (struct table *table)
 
BSTR get_method_name (const WCHAR *class, UINT index)
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 19 of file table.c.

Function Documentation

◆ add_table()

BOOL add_table ( struct table table)

Definition at line 389 of file table.c.

390 {
391  struct table *iter;
392 
393  LIST_FOR_EACH_ENTRY( iter, table_list, struct table, entry )
394  {
395  if (!strcmpiW( iter->name, table->name ))
396  {
397  TRACE("table %s already exists\n", debugstr_w(table->name));
398  return FALSE;
399  }
400  }
401  list_add_tail( table_list, &table->entry );
402  TRACE("added %p\n", table);
403  return TRUE;
404 }
#define TRUE
Definition: types.h:120
const WCHAR * name
__WINE_SERVER_LIST_INLINE void list_add_tail(struct list *list, struct list *elem)
Definition: list.h:102
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
#define debugstr_w
Definition: kernel32.h:32
struct list entry
#define TRACE(s)
Definition: solgame.cpp:4
uint32_t entry
Definition: isohybrid.c:63
#define strcmpiW(s1, s2)
Definition: unicode.h:39

Referenced by create_signature_table().

◆ addref_table()

struct table* addref_table ( struct table table)

Definition at line 348 of file table.c.

349 {
351  return table;
352 }
GLenum GLsizei GLenum GLenum const GLvoid * table
Definition: glext.h:5644
#define InterlockedIncrement
Definition: armddk.h:53

Referenced by create_record(), and grab_table().

◆ clear_table()

void clear_table ( struct table table)

Definition at line 303 of file table.c.

304 {
305  UINT i;
306 
307  if (!table->data) return;
308 
309  for (i = 0; i < table->num_rows; i++) free_row_values( table, i );
310  if (table->fill)
311  {
312  table->num_rows = 0;
314  heap_free( table->data );
315  table->data = NULL;
316  }
317 }
UINT num_rows
enum fill_status(* fill)(struct table *, const struct expr *cond)
void free_row_values(const struct table *table, UINT row)
Definition: table.c:281
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
smooth NULL
Definition: ftsmooth.c:416
UINT num_rows_allocated
BYTE * data
unsigned int UINT
Definition: ndis.h:50
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by execute_view(), and free_table().

◆ create_table()

struct table* create_table ( const WCHAR name,
UINT  num_cols,
const struct column columns,
UINT  num_rows,
UINT  num_allocated,
BYTE data,
enum fill_status(*)(struct table *, const struct expr *cond)  fill 
)

Definition at line 369 of file table.c.

372 {
373  struct table *table;
374 
375  if (!(table = heap_alloc( sizeof(*table) ))) return NULL;
376  table->name = heap_strdupW( name );
378  table->columns = columns;
380  table->num_rows_allocated = num_allocated;
381  table->data = data;
382  table->fill = fill;
384  table->refs = 0;
385  list_init( &table->entry );
386  return table;
387 }
UINT num_cols
const WCHAR * name
UINT num_rows
const struct column * columns
GLenum GLsizei GLenum GLenum const GLvoid * table
Definition: glext.h:5644
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
enum fill_status(* fill)(struct table *, const struct expr *cond)
static WCHAR * heap_strdupW(const WCHAR *str)
Definition: propsheet.c:178
struct list entry
smooth NULL
Definition: ftsmooth.c:416
_STLP_MOVE_TO_STD_NAMESPACE void fill(_ForwardIter __first, _ForwardIter __last, const _Tp &__val)
Definition: _algobase.h:449
UINT num_rows_allocated
int JSAMPARRAY int int num_rows
Definition: jpegint.h:412
int JSAMPARRAY int int JDIMENSION num_cols
Definition: jpegint.h:412
#define TABLE_FLAG_DYNAMIC
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
BYTE * data
Definition: name.c:36
__WINE_SERVER_LIST_INLINE void list_init(struct list *list)
Definition: list.h:149

Referenced by create_signature_table().

◆ free_columns()

void free_columns ( struct column columns,
UINT  num_cols 
)

Definition at line 319 of file table.c.

320 {
321  UINT i;
322 
323  for (i = 0; i < num_cols; i++) { heap_free( (WCHAR *)columns[i].name ); }
324  heap_free( columns );
325 }
const struct column * columns
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
__wchar_t WCHAR
Definition: xmlstorage.h:180
int JSAMPARRAY int int JDIMENSION num_cols
Definition: jpegint.h:412
unsigned int UINT
Definition: ndis.h:50
Definition: name.c:36
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by create_signature_table(), and free_table().

◆ free_row_values()

void free_row_values ( const struct table table,
UINT  row 
)

Definition at line 281 of file table.c.

282 {
283  UINT i, type;
284  LONGLONG val;
285 
286  for (i = 0; i < table->num_cols; i++)
287  {
288  if (!(table->columns[i].type & COL_FLAG_DYNAMIC)) continue;
289 
290  type = table->columns[i].type & COL_TYPE_MASK;
291  if (type == CIM_STRING || type == CIM_DATETIME)
292  {
293  if (get_value( table, row, i, &val ) == S_OK) heap_free( (void *)(INT_PTR)val );
294  }
295  else if (type & CIM_FLAG_ARRAY)
296  {
297  if (get_value( table, row, i, &val ) == S_OK)
298  destroy_array( (void *)(INT_PTR)val, type & CIM_TYPE_MASK );
299  }
300  }
301 }
UINT num_cols
const struct column * columns
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
int32_t INT_PTR
Definition: typedefs.h:62
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 CIM_TYPE_MASK
void destroy_array(struct array *array, CIMTYPE type)
Definition: class.c:237
#define COL_TYPE_MASK
GLuint GLfloat * val
Definition: glext.h:7180
int64_t LONGLONG
Definition: typedefs.h:66
#define COL_FLAG_DYNAMIC
#define S_OK
Definition: intsafe.h:59
HRESULT get_value(const struct table *table, UINT row, UINT column, LONGLONG *val)
Definition: table.c:94
unsigned int UINT
Definition: ndis.h:50
struct png_info_def *typedef unsigned char **typedef struct png_info_def *typedef struct png_info_def *typedef struct png_info_def *typedef unsigned char ** row
Definition: typeof.h:78
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by clear_table(), fill_cdromdrive(), fill_compsys(), fill_compsysproduct(), fill_datafile(), fill_directory(), fill_diskdrive(), fill_diskpartition(), fill_ip4routetable(), fill_logicaldisk(), fill_networkadapter(), fill_networkadapterconfig(), fill_os(), fill_physicalmemory(), fill_pnpentity(), fill_printer(), fill_process(), fill_processor(), fill_service(), and fill_videocontroller().

◆ free_table()

void free_table ( struct table table)

Definition at line 327 of file table.c.

328 {
329  if (!table) return;
330 
331  clear_table( table );
333  {
334  TRACE("destroying %p\n", table);
335  heap_free( (WCHAR *)table->name );
336  free_columns( (struct column *)table->columns, table->num_cols );
337  heap_free( table->data );
338  list_remove( &table->entry );
339  heap_free( table );
340  }
341 }
UINT num_cols
void free_columns(struct column *columns, UINT num_cols)
Definition: table.c:319
const WCHAR * name
const struct column * columns
struct list entry
__WINE_SERVER_LIST_INLINE void list_remove(struct list *elem)
Definition: list.h:108
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define TABLE_FLAG_DYNAMIC
void clear_table(struct table *table)
Definition: table.c:303
BYTE * data
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by release_table().

◆ get_column_index()

HRESULT get_column_index ( const struct table table,
const WCHAR name,
UINT column 
)

Definition at line 33 of file table.c.

34 {
35  UINT i;
36  for (i = 0; i < table->num_cols; i++)
37  {
38  if (!strcmpiW( table->columns[i].name, name ))
39  {
40  *column = i;
41  return S_OK;
42  }
43  }
44  return WBEM_E_INVALID_QUERY;
45 }
UINT num_cols
const struct column * columns
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 strcmpiW(s1, s2)
Definition: unicode.h:39
#define S_OK
Definition: intsafe.h:59
unsigned int UINT
Definition: ndis.h:50
Definition: name.c:36

Referenced by class_object_Get(), class_object_Put(), eval_propval(), eval_unary(), get_propval(), and put_propval().

◆ get_column_offset()

static UINT get_column_offset ( const struct table table,
UINT  column 
)
static

Definition at line 82 of file table.c.

83 {
84  UINT i, offset = 0;
85  for (i = 0; i < column; i++) offset += get_column_size( table, i );
86  return offset;
87 }
GLintptr offset
Definition: glext.h:5920
static UINT get_column_size(const struct table *table, UINT column)
Definition: table.c:77
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
unsigned int UINT
Definition: ndis.h:50
GLenum GLenum GLvoid GLvoid * column
Definition: glext.h:5664

Referenced by get_row_size(), get_value(), and set_value().

◆ get_column_size()

static UINT get_column_size ( const struct table table,
UINT  column 
)
static

Definition at line 77 of file table.c.

78 {
79  return get_type_size( table->columns[column].type & COL_TYPE_MASK );
80 }
const struct column * columns
#define COL_TYPE_MASK
UINT get_type_size(CIMTYPE type)
Definition: table.c:47

Referenced by get_column_offset(), and get_row_size().

◆ get_method()

HRESULT get_method ( const struct table table,
const WCHAR name,
class_method **  func 
)

Definition at line 258 of file table.c.

259 {
260  UINT i, j;
261 
262  for (i = 0; i < table->num_rows; i++)
263  {
264  for (j = 0; j < table->num_cols; j++)
265  {
266  if (table->columns[j].type & COL_FLAG_METHOD && !strcmpW( table->columns[j].name, name ))
267  {
268  HRESULT hr;
269  LONGLONG val;
270 
271  if ((hr = get_value( table, i, j, &val )) != S_OK) return hr;
272  *func = (class_method *)(INT_PTR)val;
273  return S_OK;
274  }
275  }
276  }
277  return WBEM_E_INVALID_METHOD;
278 
279 }
GLenum func
Definition: glext.h:6028
UINT num_cols
HRESULT hr
Definition: shlfolder.c:183
UINT num_rows
const struct column * columns
int32_t INT_PTR
Definition: typedefs.h:62
#define COL_FLAG_METHOD
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
GLuint GLfloat * val
Definition: glext.h:7180
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 GLint GLint j
Definition: glfuncs.h:250
int64_t LONGLONG
Definition: typedefs.h:66
LONG HRESULT
Definition: typedefs.h:77
HRESULT() class_method(IWbemClassObject *, IWbemClassObject *, IWbemClassObject **)
#define S_OK
Definition: intsafe.h:59
HRESULT get_value(const struct table *table, UINT row, UINT column, LONGLONG *val)
Definition: table.c:94
unsigned int UINT
Definition: ndis.h:50
Definition: name.c:36
WINE_UNICODE_INLINE int strcmpW(const WCHAR *str1, const WCHAR *str2)
Definition: unicode.h:229

Referenced by wbem_services_ExecMethod().

◆ get_method_name()

BSTR get_method_name ( const WCHAR class,
UINT  index 
)

Definition at line 406 of file table.c.

407 {
408  struct table *table;
409  UINT i, count = 0;
410  BSTR ret;
411 
412  if (!(table = grab_table( class ))) return NULL;
413 
414  for (i = 0; i < table->num_cols; i++)
415  {
416  if (table->columns[i].type & COL_FLAG_METHOD)
417  {
418  if (index == count)
419  {
420  ret = SysAllocString( table->columns[i].name );
421  release_table( table );
422  return ret;
423  }
424  count++;
425  }
426  }
427  release_table( table );
428  return NULL;
429 }
UINT num_cols
GLuint GLuint GLsizei count
Definition: gl.h:1545
const struct column * columns
GLenum GLsizei GLenum GLenum const GLvoid * table
Definition: glext.h:5644
OLECHAR * BSTR
Definition: compat.h:1934
#define COL_FLAG_METHOD
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
smooth NULL
Definition: ftsmooth.c:416
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:241
GLuint index
Definition: glext.h:6031
struct table * grab_table(const WCHAR *name)
Definition: table.c:354
void release_table(struct table *table)
Definition: table.c:343
int ret
unsigned int UINT
Definition: ndis.h:50

Referenced by class_object_NextMethod().

◆ get_row_size()

static UINT get_row_size ( const struct table table)
static

Definition at line 89 of file table.c.

90 {
92 }
UINT num_cols
static UINT get_column_size(const struct table *table, UINT column)
Definition: table.c:77
static UINT get_column_offset(const struct table *table, UINT column)
Definition: table.c:82

Referenced by get_value(), and set_value().

◆ get_type_size()

UINT get_type_size ( CIMTYPE  type)

Definition at line 47 of file table.c.

48 {
49  if (type & CIM_FLAG_ARRAY) return sizeof(void *);
50 
51  switch (type)
52  {
53  case CIM_BOOLEAN:
54  return sizeof(int);
55  case CIM_SINT8:
56  case CIM_UINT8:
57  return sizeof(INT8);
58  case CIM_SINT16:
59  case CIM_UINT16:
60  return sizeof(INT16);
61  case CIM_SINT32:
62  case CIM_UINT32:
63  return sizeof(INT32);
64  case CIM_SINT64:
65  case CIM_UINT64:
66  return sizeof(INT64);
67  case CIM_DATETIME:
68  case CIM_STRING:
69  return sizeof(WCHAR *);
70  default:
71  ERR("unhandled type %u\n", type);
72  break;
73  }
74  return sizeof(LONGLONG);
75 }
signed char INT8
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
int64_t LONGLONG
Definition: typedefs.h:66
__wchar_t WCHAR
Definition: xmlstorage.h:180
signed long long INT64
#define ERR(fmt,...)
Definition: debug.h:109
signed int INT32
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
signed short INT16

Referenced by get_column_size().

◆ get_value()

HRESULT get_value ( const struct table table,
UINT  row,
UINT  column,
LONGLONG val 
)

Definition at line 94 of file table.c.

95 {
96  UINT col_offset, row_size;
97  const BYTE *ptr;
98 
99  col_offset = get_column_offset( table, column );
100  row_size = get_row_size( table );
101  ptr = table->data + row * row_size + col_offset;
102 
103  if (table->columns[column].type & CIM_FLAG_ARRAY)
104  {
105  *val = (INT_PTR)*(const void **)ptr;
106  return S_OK;
107  }
108  switch (table->columns[column].type & COL_TYPE_MASK)
109  {
110  case CIM_BOOLEAN:
111  *val = *(const int *)ptr;
112  break;
113  case CIM_DATETIME:
114  case CIM_STRING:
115  *val = (INT_PTR)*(const WCHAR **)ptr;
116  break;
117  case CIM_SINT8:
118  *val = *(const INT8 *)ptr;
119  break;
120  case CIM_UINT8:
121  *val = *(const UINT8 *)ptr;
122  break;
123  case CIM_SINT16:
124  *val = *(const INT16 *)ptr;
125  break;
126  case CIM_UINT16:
127  *val = *(const UINT16 *)ptr;
128  break;
129  case CIM_SINT32:
130  *val = *(const INT32 *)ptr;
131  break;
132  case CIM_UINT32:
133  *val = *(const UINT32 *)ptr;
134  break;
135  case CIM_SINT64:
136  *val = *(const INT64 *)ptr;
137  break;
138  case CIM_UINT64:
139  *val = *(const UINT64 *)ptr;
140  break;
141  default:
142  ERR("invalid column type %u\n", table->columns[column].type & COL_TYPE_MASK);
143  *val = 0;
144  break;
145  }
146  return S_OK;
147 }
signed char INT8
const struct column * columns
int32_t INT_PTR
Definition: typedefs.h:62
unsigned int UINT32
static PVOID ptr
Definition: dispmode.c:27
#define COL_TYPE_MASK
GLuint GLfloat * val
Definition: glext.h:7180
__wchar_t WCHAR
Definition: xmlstorage.h:180
signed long long INT64
unsigned char BYTE
Definition: mem.h:68
static UINT get_column_offset(const struct table *table, UINT column)
Definition: table.c:82
#define ERR(fmt,...)
Definition: debug.h:109
#define S_OK
Definition: intsafe.h:59
BYTE * data
unsigned short UINT16
unsigned int UINT
Definition: ndis.h:50
static UINT get_row_size(const struct table *table)
Definition: table.c:89
signed int INT32
unsigned long long UINT64
unsigned char UINT8
struct png_info_def *typedef unsigned char **typedef struct png_info_def *typedef struct png_info_def *typedef struct png_info_def *typedef unsigned char ** row
Definition: typeof.h:78
signed short INT16

Referenced by eval_propval(), eval_unary(), free_row_values(), get_method(), get_propval(), and get_value_bstr().

◆ get_value_bstr()

BSTR get_value_bstr ( const struct table table,
UINT  row,
UINT  column 
)

Definition at line 149 of file table.c.

150 {
151  static const WCHAR fmt_signedW[] = {'%','d',0};
152  static const WCHAR fmt_unsignedW[] = {'%','u',0};
153  static const WCHAR fmt_signed64W[] = {'%','I','6','4','d',0};
154  static const WCHAR fmt_unsigned64W[] = {'%','I','6','4','u',0};
155  static const WCHAR fmt_strW[] = {'\"','%','s','\"',0};
156  static const WCHAR trueW[] = {'T','R','U','E',0};
157  static const WCHAR falseW[] = {'F','A','L','S','E',0};
158  LONGLONG val;
159  BSTR ret;
160  WCHAR number[22];
161  UINT len;
162 
163  if (table->columns[column].type & CIM_FLAG_ARRAY)
164  {
165  FIXME("array to string conversion not handled\n");
166  return NULL;
167  }
168  if (get_value( table, row, column, &val ) != S_OK) return NULL;
169 
170  switch (table->columns[column].type & COL_TYPE_MASK)
171  {
172  case CIM_BOOLEAN:
173  if (val) return SysAllocString( trueW );
174  else return SysAllocString( falseW );
175 
176  case CIM_DATETIME:
177  case CIM_STRING:
178  if (!val) return NULL;
179  len = strlenW( (const WCHAR *)(INT_PTR)val ) + 2;
180  if (!(ret = SysAllocStringLen( NULL, len ))) return NULL;
181  sprintfW( ret, fmt_strW, (const WCHAR *)(INT_PTR)val );
182  return ret;
183 
184  case CIM_SINT16:
185  case CIM_SINT32:
186  sprintfW( number, fmt_signedW, val );
187  return SysAllocString( number );
188 
189  case CIM_UINT16:
190  case CIM_UINT32:
191  sprintfW( number, fmt_unsignedW, val );
192  return SysAllocString( number );
193 
194  case CIM_SINT64:
195  wsprintfW( number, fmt_signed64W, val );
196  return SysAllocString( number );
197 
198  case CIM_UINT64:
199  wsprintfW( number, fmt_unsigned64W, val );
200  return SysAllocString( number );
201 
202  default:
203  FIXME("unhandled column type %u\n", table->columns[column].type & COL_TYPE_MASK);
204  break;
205  }
206  return NULL;
207 }
int WINAPIV wsprintfW(_Out_ LPWSTR, _In_ _Printf_format_string_ LPCWSTR,...)
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
BSTR WINAPI SysAllocStringLen(const OLECHAR *str, unsigned int len)
Definition: oleaut.c:342
const struct column * columns
OLECHAR * BSTR
Definition: compat.h:1934
int32_t INT_PTR
Definition: typedefs.h:62
static size_t double number
Definition: printf.c:69
#define FIXME(fmt,...)
Definition: debug.h:110
#define COL_TYPE_MASK
smooth NULL
Definition: ftsmooth.c:416
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:241
GLuint GLfloat * val
Definition: glext.h:7180
int64_t LONGLONG
Definition: typedefs.h:66
__wchar_t WCHAR
Definition: xmlstorage.h:180
static const WCHAR falseW[]
Definition: json.c:34
int ret
GLenum GLsizei len
Definition: glext.h:6722
#define S_OK
Definition: intsafe.h:59
HRESULT get_value(const struct table *table, UINT row, UINT column, LONGLONG *val)
Definition: table.c:94
#define sprintfW
Definition: unicode.h:58
unsigned int UINT
Definition: ndis.h:50
static const WCHAR trueW[]
Definition: json.c:33
struct png_info_def *typedef unsigned char **typedef struct png_info_def *typedef struct png_info_def *typedef struct png_info_def *typedef unsigned char ** row
Definition: typeof.h:78

Referenced by build_proplist(), get_body_text(), and get_propval().

◆ grab_table()

struct table* grab_table ( const WCHAR name)

Definition at line 354 of file table.c.

355 {
356  struct table *table;
357 
358  LIST_FOR_EACH_ENTRY( table, table_list, struct table, entry )
359  {
360  if (!strcmpiW( table->name, name ))
361  {
362  TRACE("returning %p\n", table);
363  return addref_table( table );
364  }
365  }
366  return NULL;
367 }
const WCHAR * name
GLenum GLsizei GLenum GLenum const GLvoid * table
Definition: glext.h:5644
struct table * addref_table(struct table *table)
Definition: table.c:348
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
uint32_t entry
Definition: isohybrid.c:63
#define strcmpiW(s1, s2)
Definition: unicode.h:39
Definition: name.c:36

Referenced by create_view(), and get_method_name().

◆ release_table()

void release_table ( struct table table)

Definition at line 343 of file table.c.

344 {
346 }
void free_table(struct table *table)
Definition: table.c:327
#define InterlockedDecrement
Definition: armddk.h:52

Referenced by destroy_record(), destroy_view(), and get_method_name().

◆ set_value()

HRESULT set_value ( const struct table table,
UINT  row,
UINT  column,
LONGLONG  val,
CIMTYPE  type 
)

Definition at line 209 of file table.c.

211 {
212  UINT col_offset, row_size;
213  BYTE *ptr;
214 
215  if ((table->columns[column].type & COL_TYPE_MASK) != type) return WBEM_E_TYPE_MISMATCH;
216 
217  col_offset = get_column_offset( table, column );
218  row_size = get_row_size( table );
219  ptr = table->data + row * row_size + col_offset;
220 
221  switch (table->columns[column].type & COL_TYPE_MASK)
222  {
223  case CIM_DATETIME:
224  case CIM_STRING:
225  *(WCHAR **)ptr = (WCHAR *)(INT_PTR)val;
226  break;
227  case CIM_SINT8:
228  *(INT8 *)ptr = val;
229  break;
230  case CIM_UINT8:
231  *(UINT8 *)ptr = val;
232  break;
233  case CIM_SINT16:
234  *(INT16 *)ptr = val;
235  break;
236  case CIM_UINT16:
237  *(UINT16 *)ptr = val;
238  break;
239  case CIM_SINT32:
240  *(INT32 *)ptr = val;
241  break;
242  case CIM_UINT32:
243  *(UINT32 *)ptr = val;
244  break;
245  case CIM_SINT64:
246  *(INT64 *)ptr = val;
247  break;
248  case CIM_UINT64:
249  *(UINT64 *)ptr = val;
250  break;
251  default:
252  FIXME("unhandled column type %u\n", type);
253  return WBEM_E_FAILED;
254  }
255  return S_OK;
256 }
signed char INT8
const struct column * columns
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
int32_t INT_PTR
Definition: typedefs.h:62
unsigned int UINT32
#define FIXME(fmt,...)
Definition: debug.h:110
static PVOID ptr
Definition: dispmode.c:27
#define COL_TYPE_MASK
GLuint GLfloat * val
Definition: glext.h:7180
__wchar_t WCHAR
Definition: xmlstorage.h:180
signed long long INT64
unsigned char BYTE
Definition: mem.h:68
static UINT get_column_offset(const struct table *table, UINT column)
Definition: table.c:82
#define S_OK
Definition: intsafe.h:59
BYTE * data
unsigned short UINT16
unsigned int UINT
Definition: ndis.h:50
static UINT get_row_size(const struct table *table)
Definition: table.c:89
signed int INT32
unsigned long long UINT64
unsigned char UINT8
struct png_info_def *typedef unsigned char **typedef struct png_info_def *typedef struct png_info_def *typedef struct png_info_def *typedef unsigned char ** row
Definition: typeof.h:78
signed short INT16

Referenced by hex_data_state(), and put_propval().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( wbemprox  )