ReactOS  0.4.15-dev-1197-g8081ba9
table.c File Reference
#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 400 of file table.c.

401 {
402  struct table *iter;
403 
404  LIST_FOR_EACH_ENTRY( iter, table_list, struct table, entry )
405  {
406  if (!wcsicmp( iter->name, table->name ))
407  {
408  TRACE("table %s already exists\n", debugstr_w(table->name));
409  return FALSE;
410  }
411  }
412  list_add_tail( table_list, &table->entry );
413  TRACE("added %p\n", table);
414  return TRUE;
415 }
const WCHAR * name
#define TRUE
Definition: types.h:120
__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 FALSE
Definition: types.h:117
#define debugstr_w
Definition: kernel32.h:32
struct list entry
#define TRACE(s)
Definition: solgame.cpp:4
#define wcsicmp
Definition: compat.h:15
uint32_t entry
Definition: isohybrid.c:63

Referenced by create_signature_table().

◆ addref_table()

struct table* addref_table ( struct table table)

Definition at line 359 of file table.c.

360 {
362  return table;
363 }
GLenum GLsizei GLenum GLenum const GLvoid * table
Definition: glext.h:5644
#define InterlockedIncrement
Definition: armddk.h:53

Referenced by create_record(), get_antecedent_table(), and grab_table().

◆ clear_table()

void clear_table ( struct table table)

Definition at line 314 of file table.c.

315 {
316  UINT i;
317 
318  if (!table->data) return;
319 
320  for (i = 0; i < table->num_rows; i++) free_row_values( table, i );
321  if (table->fill)
322  {
323  table->num_rows = 0;
325  heap_free( table->data );
326  table->data = NULL;
327  }
328 }
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:292
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 exec_select_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 380 of file table.c.

383 {
384  struct table *table;
385 
386  if (!(table = heap_alloc( sizeof(*table) ))) return NULL;
387  table->name = heap_strdupW( name );
389  table->columns = columns;
391  table->num_rows_allocated = num_allocated;
392  table->data = data;
393  table->fill = fill;
395  table->refs = 0;
396  list_init( &table->entry );
397  return table;
398 }
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:419
int JSAMPARRAY int int JDIMENSION num_cols
Definition: jpegint.h:419
#define TABLE_FLAG_DYNAMIC
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
BYTE * data
Definition: name.c:38
__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 330 of file table.c.

331 {
332  UINT i;
333 
334  for (i = 0; i < num_cols; i++) { heap_free( (WCHAR *)columns[i].name ); }
335  heap_free( columns );
336 }
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:419
unsigned int UINT
Definition: ndis.h:50
Definition: name.c:38
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 292 of file table.c.

293 {
294  UINT i, type;
295  LONGLONG val;
296 
297  for (i = 0; i < table->num_cols; i++)
298  {
299  if (!(table->columns[i].type & COL_FLAG_DYNAMIC)) continue;
300 
301  type = table->columns[i].type & COL_TYPE_MASK;
302  if (type == CIM_STRING || type == CIM_DATETIME || type == CIM_REFERENCE)
303  {
304  if (get_value( table, row, i, &val ) == S_OK) heap_free( (void *)(INT_PTR)val );
305  }
306  else if (type & CIM_FLAG_ARRAY)
307  {
308  if (get_value( table, row, i, &val ) == S_OK)
309  destroy_array( (void *)(INT_PTR)val, type & CIM_TYPE_MASK );
310  }
311  }
312 }
UINT num_cols
const struct column * columns
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
int32_t INT_PTR
Definition: typedefs.h:64
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:240
#define COL_TYPE_MASK
GLuint GLfloat * val
Definition: glext.h:7180
int64_t LONGLONG
Definition: typedefs.h:68
#define COL_FLAG_DYNAMIC
#define S_OK
Definition: intsafe.h:51
HRESULT get_value(const struct table *table, UINT row, UINT column, LONGLONG *val)
Definition: table.c:99
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_baseboard(), fill_bios(), fill_cdromdrive(), fill_compsys(), fill_compsysproduct(), fill_datafile(), fill_directory(), fill_diskdrive(), fill_diskdrivetodiskpartition(), fill_diskpartition(), fill_displaycontrollerconfig(), fill_ip4routetable(), fill_logicaldisk(), fill_logicaldisktopartition(), fill_networkadapter(), fill_networkadapterconfig(), fill_operatingsystem(), fill_physicalmemory(), fill_pnpentity(), fill_printer(), fill_process(), fill_processor(), fill_service(), fill_systemenclosure(), and fill_videocontroller().

◆ free_table()

void free_table ( struct table table)

Definition at line 338 of file table.c.

339 {
340  if (!table) return;
341 
342  clear_table( table );
344  {
345  TRACE("destroying %p\n", table);
346  heap_free( (WCHAR *)table->name );
347  free_columns( (struct column *)table->columns, table->num_cols );
348  heap_free( table->data );
349  list_remove( &table->entry );
350  heap_free( table );
351  }
352 }
UINT num_cols
void free_columns(struct column *columns, UINT num_cols)
Definition: table.c:330
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:314
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 35 of file table.c.

36 {
37  UINT i;
38  for (i = 0; i < table->num_cols; i++)
39  {
40  if (!wcsicmp( table->columns[i].name, name ))
41  {
42  *column = i;
43  return S_OK;
44  }
45  }
46  return WBEM_E_INVALID_QUERY;
47 }
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 wcsicmp
Definition: compat.h:15
#define S_OK
Definition: intsafe.h:51
unsigned int UINT
Definition: ndis.h:50
Definition: name.c:38

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 87 of file table.c.

88 {
89  UINT i, offset = 0;
90  for (i = 0; i < column; i++) offset += get_column_size( table, i );
91  return offset;
92 }
GLintptr offset
Definition: glext.h:5920
static UINT get_column_size(const struct table *table, UINT column)
Definition: table.c:82
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 82 of file table.c.

83 {
84  return get_type_size( table->columns[column].type & COL_TYPE_MASK );
85 }
const struct column * columns
#define COL_TYPE_MASK
UINT get_type_size(CIMTYPE type)
Definition: table.c:49

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 269 of file table.c.

270 {
271  UINT i, j;
272 
273  for (i = 0; i < table->num_rows; i++)
274  {
275  for (j = 0; j < table->num_cols; j++)
276  {
277  if (table->columns[j].type & COL_FLAG_METHOD && !wcscmp( table->columns[j].name, name ))
278  {
279  HRESULT hr;
280  LONGLONG val;
281 
282  if ((hr = get_value( table, i, j, &val )) != S_OK) return hr;
283  *func = (class_method *)(INT_PTR)val;
284  return S_OK;
285  }
286  }
287  }
288  return WBEM_E_INVALID_METHOD;
289 
290 }
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:64
#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:68
LONG HRESULT
Definition: typedefs.h:79
HRESULT() class_method(IWbemClassObject *, IWbemClassObject *, IWbemClassObject **)
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
#define S_OK
Definition: intsafe.h:51
HRESULT get_value(const struct table *table, UINT row, UINT column, LONGLONG *val)
Definition: table.c:99
unsigned int UINT
Definition: ndis.h:50
Definition: name.c:38

Referenced by wbem_services_ExecMethod().

◆ get_method_name()

BSTR get_method_name ( const WCHAR class,
UINT  index 
)

Definition at line 417 of file table.c.

418 {
419  struct table *table;
420  UINT i, count = 0;
421  BSTR ret;
422 
423  if (!(table = grab_table( class ))) return NULL;
424 
425  for (i = 0; i < table->num_cols; i++)
426  {
427  if (table->columns[i].type & COL_FLAG_METHOD)
428  {
429  if (index == count)
430  {
431  ret = SysAllocString( table->columns[i].name );
432  release_table( table );
433  return ret;
434  }
435  count++;
436  }
437  }
438  release_table( table );
439  return NULL;
440 }
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:2041
#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:238
GLuint index
Definition: glext.h:6031
struct table * grab_table(const WCHAR *name)
Definition: table.c:365
void release_table(struct table *table)
Definition: table.c:354
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 94 of file table.c.

95 {
97 }
UINT num_cols
static UINT get_column_size(const struct table *table, UINT column)
Definition: table.c:82
static UINT get_column_offset(const struct table *table, UINT column)
Definition: table.c:87

Referenced by get_value(), and set_value().

◆ get_type_size()

UINT get_type_size ( CIMTYPE  type)

Definition at line 49 of file table.c.

50 {
51  if (type & CIM_FLAG_ARRAY) return sizeof(void *);
52 
53  switch (type)
54  {
55  case CIM_BOOLEAN:
56  return sizeof(int);
57  case CIM_SINT8:
58  case CIM_UINT8:
59  return sizeof(INT8);
60  case CIM_SINT16:
61  case CIM_UINT16:
62  return sizeof(INT16);
63  case CIM_SINT32:
64  case CIM_UINT32:
65  return sizeof(INT32);
66  case CIM_SINT64:
67  case CIM_UINT64:
68  return sizeof(INT64);
69  case CIM_DATETIME:
70  case CIM_REFERENCE:
71  case CIM_STRING:
72  return sizeof(WCHAR *);
73  case CIM_REAL32:
74  return sizeof(FLOAT);
75  default:
76  ERR("unhandled type %u\n", type);
77  break;
78  }
79  return sizeof(LONGLONG);
80 }
signed char INT8
#define FLOAT
Definition: i386-dis.c:516
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
int64_t LONGLONG
Definition: typedefs.h:68
__wchar_t WCHAR
Definition: xmlstorage.h:180
signed long long INT64
#define ERR(fmt,...)
Definition: debug.h:110
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 99 of file table.c.

100 {
101  UINT col_offset, row_size;
102  const BYTE *ptr;
103 
104  col_offset = get_column_offset( table, column );
105  row_size = get_row_size( table );
106  ptr = table->data + row * row_size + col_offset;
107 
108  if (table->columns[column].type & CIM_FLAG_ARRAY)
109  {
110  *val = (INT_PTR)*(const void **)ptr;
111  return S_OK;
112  }
113  switch (table->columns[column].type & COL_TYPE_MASK)
114  {
115  case CIM_BOOLEAN:
116  *val = *(const int *)ptr;
117  break;
118  case CIM_DATETIME:
119  case CIM_REFERENCE:
120  case CIM_STRING:
121  *val = (INT_PTR)*(const WCHAR **)ptr;
122  break;
123  case CIM_SINT8:
124  *val = *(const INT8 *)ptr;
125  break;
126  case CIM_UINT8:
127  *val = *(const UINT8 *)ptr;
128  break;
129  case CIM_SINT16:
130  *val = *(const INT16 *)ptr;
131  break;
132  case CIM_UINT16:
133  *val = *(const UINT16 *)ptr;
134  break;
135  case CIM_SINT32:
136  *val = *(const INT32 *)ptr;
137  break;
138  case CIM_UINT32:
139  *val = *(const UINT32 *)ptr;
140  break;
141  case CIM_SINT64:
142  *val = *(const INT64 *)ptr;
143  break;
144  case CIM_UINT64:
145  *val = *(const UINT64 *)ptr;
146  break;
147  case CIM_REAL32:
148  memcpy( val, ptr, sizeof(FLOAT) );
149  break;
150  default:
151  ERR("invalid column type %u\n", table->columns[column].type & COL_TYPE_MASK);
152  *val = 0;
153  break;
154  }
155  return S_OK;
156 }
signed char INT8
const struct column * columns
int32_t INT_PTR
Definition: typedefs.h:64
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
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
unsigned char BYTE
Definition: xxhash.c:193
static UINT get_column_offset(const struct table *table, UINT column)
Definition: table.c:87
#define ERR(fmt,...)
Definition: debug.h:110
#define S_OK
Definition: intsafe.h:51
BYTE * data
unsigned short UINT16
unsigned int UINT
Definition: ndis.h:50
static UINT get_row_size(const struct table *table)
Definition: table.c:94
float FLOAT
Definition: typedefs.h:69
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 158 of file table.c.

159 {
160  static const WCHAR fmt_signedW[] = {'%','d',0};
161  static const WCHAR fmt_unsignedW[] = {'%','u',0};
162  static const WCHAR fmt_signed64W[] = {'%','I','6','4','d',0};
163  static const WCHAR fmt_unsigned64W[] = {'%','I','6','4','u',0};
164  static const WCHAR fmt_strW[] = {'\"','%','s','\"',0};
165  static const WCHAR trueW[] = {'T','R','U','E',0};
166  static const WCHAR falseW[] = {'F','A','L','S','E',0};
167  LONGLONG val;
168  BSTR ret;
169  WCHAR number[22];
170  UINT len;
171 
172  if (table->columns[column].type & CIM_FLAG_ARRAY)
173  {
174  FIXME("array to string conversion not handled\n");
175  return NULL;
176  }
177  if (get_value( table, row, column, &val ) != S_OK) return NULL;
178 
179  switch (table->columns[column].type & COL_TYPE_MASK)
180  {
181  case CIM_BOOLEAN:
182  if (val) return SysAllocString( trueW );
183  else return SysAllocString( falseW );
184 
185  case CIM_DATETIME:
186  case CIM_REFERENCE:
187  case CIM_STRING:
188  if (!val) return NULL;
189  len = lstrlenW( (const WCHAR *)(INT_PTR)val ) + 2;
190  if (!(ret = SysAllocStringLen( NULL, len ))) return NULL;
191  swprintf( ret, fmt_strW, (const WCHAR *)(INT_PTR)val );
192  return ret;
193 
194  case CIM_SINT16:
195  case CIM_SINT32:
196  swprintf( number, fmt_signedW, val );
197  return SysAllocString( number );
198 
199  case CIM_UINT16:
200  case CIM_UINT32:
201  swprintf( number, fmt_unsignedW, val );
202  return SysAllocString( number );
203 
204  case CIM_SINT64:
205  wsprintfW( number, fmt_signed64W, val );
206  return SysAllocString( number );
207 
208  case CIM_UINT64:
209  wsprintfW( number, fmt_unsigned64W, val );
210  return SysAllocString( number );
211 
212  default:
213  FIXME("unhandled column type %u\n", table->columns[column].type & COL_TYPE_MASK);
214  break;
215  }
216  return NULL;
217 }
int WINAPIV wsprintfW(_Out_ LPWSTR, _In_ _Printf_format_string_ LPCWSTR,...)
BSTR WINAPI SysAllocStringLen(const OLECHAR *str, unsigned int len)
Definition: oleaut.c:339
const struct column * columns
OLECHAR * BSTR
Definition: compat.h:2041
int32_t INT_PTR
Definition: typedefs.h:64
#define lstrlenW
Definition: compat.h:498
static size_t double number
Definition: printf.c:69
#define FIXME(fmt,...)
Definition: debug.h:111
#define COL_TYPE_MASK
smooth NULL
Definition: ftsmooth.c:416
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:238
GLuint GLfloat * val
Definition: glext.h:7180
int64_t LONGLONG
Definition: typedefs.h:68
__wchar_t WCHAR
Definition: xmlstorage.h:180
static const WCHAR falseW[]
Definition: json.c:34
#define swprintf(buf, format,...)
Definition: sprintf.c:56
int ret
GLenum GLsizei len
Definition: glext.h:6722
#define S_OK
Definition: intsafe.h:51
HRESULT get_value(const struct table *table, UINT row, UINT column, LONGLONG *val)
Definition: table.c:99
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 365 of file table.c.

366 {
367  struct table *table;
368 
369  LIST_FOR_EACH_ENTRY( table, table_list, struct table, entry )
370  {
371  if (name && !wcsicmp( table->name, name ))
372  {
373  TRACE("returning %p\n", table);
374  return addref_table( table );
375  }
376  }
377  return NULL;
378 }
const WCHAR * name
GLenum GLsizei GLenum GLenum const GLvoid * table
Definition: glext.h:5644
struct table * addref_table(struct table *table)
Definition: table.c:359
#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
#define wcsicmp
Definition: compat.h:15
uint32_t entry
Definition: isohybrid.c:63
Definition: name.c:38

Referenced by create_view(), and get_method_name().

◆ release_table()

void release_table ( struct table table)

Definition at line 354 of file table.c.

355 {
357 }
void free_table(struct table *table)
Definition: table.c:338
#define InterlockedDecrement
Definition: armddk.h:52

Referenced by destroy_record(), destroy_view(), exec_assoc_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 219 of file table.c.

221 {
222  UINT col_offset, row_size;
223  BYTE *ptr;
224 
225  if ((table->columns[column].type & COL_TYPE_MASK) != type) return WBEM_E_TYPE_MISMATCH;
226 
227  col_offset = get_column_offset( table, column );
228  row_size = get_row_size( table );
229  ptr = table->data + row * row_size + col_offset;
230 
231  switch (table->columns[column].type & COL_TYPE_MASK)
232  {
233  case CIM_DATETIME:
234  case CIM_REFERENCE:
235  case CIM_STRING:
236  *(WCHAR **)ptr = (WCHAR *)(INT_PTR)val;
237  break;
238  case CIM_SINT8:
239  *(INT8 *)ptr = val;
240  break;
241  case CIM_UINT8:
242  *(UINT8 *)ptr = val;
243  break;
244  case CIM_SINT16:
245  *(INT16 *)ptr = val;
246  break;
247  case CIM_UINT16:
248  *(UINT16 *)ptr = val;
249  break;
250  case CIM_SINT32:
251  *(INT32 *)ptr = val;
252  break;
253  case CIM_UINT32:
254  *(UINT32 *)ptr = val;
255  break;
256  case CIM_SINT64:
257  *(INT64 *)ptr = val;
258  break;
259  case CIM_UINT64:
260  *(UINT64 *)ptr = val;
261  break;
262  default:
263  FIXME("unhandled column type %u\n", type);
264  return WBEM_E_FAILED;
265  }
266  return S_OK;
267 }
signed char INT8
const struct column * columns
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
int32_t INT_PTR
Definition: typedefs.h:64
unsigned int UINT32
#define FIXME(fmt,...)
Definition: debug.h:111
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: xxhash.c:193
static UINT get_column_offset(const struct table *table, UINT column)
Definition: table.c:87
#define S_OK
Definition: intsafe.h:51
BYTE * data
unsigned short UINT16
unsigned int UINT
Definition: ndis.h:50
static UINT get_row_size(const struct table *table)
Definition: table.c:94
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  )