ReactOS  0.4.14-dev-552-g2fad488
streams.c File Reference
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winerror.h"
#include "msi.h"
#include "msiquery.h"
#include "objbase.h"
#include "msipriv.h"
#include "query.h"
#include "wine/debug.h"
#include "wine/unicode.h"
Include dependency graph for streams.c:

Go to the source code of this file.

Classes

struct  tagMSISTREAMSVIEW
 

Macros

#define COBJMACROS
 
#define NUM_STREAMS_COLS   2
 

Typedefs

typedef struct tagMSISTREAMSVIEW MSISTREAMSVIEW
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (msidb)
 
static BOOL streams_resize_table (MSIDATABASE *db, UINT size)
 
static UINT STREAMS_fetch_int (struct tagMSIVIEW *view, UINT row, UINT col, UINT *val)
 
static UINT STREAMS_fetch_stream (struct tagMSIVIEW *view, UINT row, UINT col, IStream **stm)
 
static UINT STREAMS_get_row (struct tagMSIVIEW *view, UINT row, MSIRECORD **rec)
 
static UINT STREAMS_set_row (struct tagMSIVIEW *view, UINT row, MSIRECORD *rec, UINT mask)
 
static UINT streams_find_row (MSISTREAMSVIEW *sv, MSIRECORD *rec, UINT *row)
 
static UINT STREAMS_insert_row (struct tagMSIVIEW *view, MSIRECORD *rec, UINT row, BOOL temporary)
 
static UINT STREAMS_delete_row (struct tagMSIVIEW *view, UINT row)
 
static UINT STREAMS_execute (struct tagMSIVIEW *view, MSIRECORD *record)
 
static UINT STREAMS_close (struct tagMSIVIEW *view)
 
static UINT STREAMS_get_dimensions (struct tagMSIVIEW *view, UINT *rows, UINT *cols)
 
static UINT STREAMS_get_column_info (struct tagMSIVIEW *view, UINT n, LPCWSTR *name, UINT *type, BOOL *temporary, LPCWSTR *table_name)
 
static UINT streams_modify_update (struct tagMSIVIEW *view, MSIRECORD *rec)
 
static UINT streams_modify_assign (struct tagMSIVIEW *view, MSIRECORD *rec)
 
static UINT STREAMS_modify (struct tagMSIVIEW *view, MSIMODIFY eModifyMode, MSIRECORD *rec, UINT row)
 
static UINT STREAMS_delete (struct tagMSIVIEW *view)
 
static UINT STREAMS_find_matching_rows (struct tagMSIVIEW *view, UINT col, UINT val, UINT *row, MSIITERHANDLE *handle)
 
static HRESULT open_stream (MSIDATABASE *db, const WCHAR *name, IStream **stream)
 
static MSISTREAMfind_stream (MSIDATABASE *db, const WCHAR *name)
 
static UINT append_stream (MSIDATABASE *db, const WCHAR *name, IStream *stream)
 
static UINT load_streams (MSIDATABASE *db)
 
UINT msi_get_stream (MSIDATABASE *db, const WCHAR *name, IStream **ret)
 
UINT STREAMS_CreateView (MSIDATABASE *db, MSIVIEW **view)
 
static HRESULT write_stream (IStream *dst, IStream *src)
 
UINT msi_commit_streams (MSIDATABASE *db)
 

Variables

static const MSIVIEWOPS streams_ops
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 24 of file streams.c.

◆ NUM_STREAMS_COLS

#define NUM_STREAMS_COLS   2

Definition at line 40 of file streams.c.

Typedef Documentation

◆ MSISTREAMSVIEW

Function Documentation

◆ append_stream()

static UINT append_stream ( MSIDATABASE db,
const WCHAR name,
IStream stream 
)
static

Definition at line 450 of file streams.c.

451 {
452  UINT i = db->num_streams;
453 
454  if (!streams_resize_table( db, db->num_streams + 1 ))
455  return ERROR_OUTOFMEMORY;
456 
458  db->streams[i].stream = stream;
459  db->num_streams++;
460 
461  TRACE("added %s\n", debugstr_w( name ));
462  return ERROR_SUCCESS;
463 }
MSISTREAM * streams
Definition: msipriv.h:109
#define ERROR_SUCCESS
Definition: deptool.c:10
BOOL msi_add_string(string_table *st, const WCHAR *data, int len, enum StringPersistence persistence) DECLSPEC_HIDDEN
Definition: string.c:307
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
string_table * strings
Definition: msipriv.h:99
#define debugstr_w
Definition: kernel32.h:32
IStream * stream
Definition: msipriv.h:86
#define TRACE(s)
Definition: solgame.cpp:4
GLuint GLuint stream
Definition: glext.h:7522
UINT str_index
Definition: msipriv.h:85
unsigned int UINT
Definition: ndis.h:50
Definition: name.c:38
UINT num_streams
Definition: msipriv.h:110
static BOOL streams_resize_table(MSIDATABASE *db, UINT size)
Definition: streams.c:49
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13

Referenced by load_streams(), and msi_get_stream().

◆ find_stream()

static MSISTREAM* find_stream ( MSIDATABASE db,
const WCHAR name 
)
static

Definition at line 435 of file streams.c.

436 {
437  UINT r, id, i;
438 
439  r = msi_string2id( db->strings, name, -1, &id );
440  if (r != ERROR_SUCCESS)
441  return NULL;
442 
443  for (i = 0; i < db->num_streams; i++)
444  {
445  if (db->streams[i].str_index == id) return &db->streams[i];
446  }
447  return NULL;
448 }
MSISTREAM * streams
Definition: msipriv.h:109
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
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
string_table * strings
Definition: msipriv.h:99
smooth NULL
Definition: ftsmooth.c:416
UINT msi_string2id(const string_table *st, const WCHAR *data, int len, UINT *id) DECLSPEC_HIDDEN
Definition: string.c:404
UINT str_index
Definition: msipriv.h:85
unsigned int UINT
Definition: ndis.h:50
Definition: name.c:38
UINT num_streams
Definition: msipriv.h:110
GLenum GLuint id
Definition: glext.h:5579

Referenced by load_streams(), and msi_get_stream().

◆ load_streams()

static UINT load_streams ( MSIDATABASE db)
static

Definition at line 465 of file streams.c.

466 {
467  WCHAR decoded[MAX_STREAM_NAME_LEN + 1];
468  IEnumSTATSTG *stgenum;
469  STATSTG stat;
470  HRESULT hr;
472  IStream *stream;
473 
474  hr = IStorage_EnumElements( db->storage, 0, NULL, 0, &stgenum );
475  if (FAILED( hr ))
476  return ERROR_FUNCTION_FAILED;
477 
478  for (;;)
479  {
480  count = 0;
481  hr = IEnumSTATSTG_Next( stgenum, 1, &stat, &count );
482  if (FAILED( hr ) || !count)
483  break;
484 
485  /* table streams are not in the _Streams table */
486  if (stat.type != STGTY_STREAM || *stat.pwcsName == 0x4840)
487  {
488  CoTaskMemFree( stat.pwcsName );
489  continue;
490  }
491  decode_streamname( stat.pwcsName, decoded );
492  if (find_stream( db, decoded ))
493  {
494  CoTaskMemFree( stat.pwcsName );
495  continue;
496  }
497  TRACE("found new stream %s\n", debugstr_w( decoded ));
498 
499  hr = open_stream( db, stat.pwcsName, &stream );
500  CoTaskMemFree( stat.pwcsName );
501  if (FAILED( hr ))
502  {
503  ERR("unable to open stream %08x\n", hr);
505  break;
506  }
507 
508  r = append_stream( db, decoded, stream );
509  if (r != ERROR_SUCCESS)
510  break;
511  }
512 
513  TRACE("loaded %u streams\n", db->num_streams);
514  IEnumSTATSTG_Release( stgenum );
515  return r;
516 }
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:420
#define ERROR_SUCCESS
Definition: deptool.c:10
HRESULT hr
Definition: shlfolder.c:183
static MSISTREAM * find_stream(MSIDATABASE *db, const WCHAR *name)
Definition: streams.c:435
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLuint GLuint GLsizei count
Definition: gl.h:1545
static HRESULT open_stream(MSIDATABASE *db, const WCHAR *name, IStream **stream)
Definition: streams.c:416
#define ERROR_FUNCTION_FAILED
Definition: winerror.h:985
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define MAX_STREAM_NAME_LEN
Definition: msipriv.h:53
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
Definition: parse.h:22
GLuint GLuint stream
Definition: glext.h:7522
Definition: stat.h:55
#define ERR(fmt,...)
Definition: debug.h:109
_CRTIMP int __cdecl stat(const char *_Filename, struct stat *_Stat)
Definition: stat.h:345
BOOL decode_streamname(LPCWSTR in, LPWSTR out) DECLSPEC_HIDDEN
Definition: table.c:187
unsigned int UINT
Definition: ndis.h:50
static UINT append_stream(MSIDATABASE *db, const WCHAR *name, IStream *stream)
Definition: streams.c:450
UINT num_streams
Definition: msipriv.h:110
IStorage * storage
Definition: msipriv.h:98

Referenced by STREAMS_CreateView().

◆ msi_commit_streams()

UINT msi_commit_streams ( MSIDATABASE db)

Definition at line 625 of file streams.c.

626 {
627  UINT i;
628  const WCHAR *name;
629  WCHAR *encname;
630  IStream *stream;
631  HRESULT hr;
632 
633  TRACE("got %u streams\n", db->num_streams);
634 
635  for (i = 0; i < db->num_streams; i++)
636  {
638  if (!(encname = encode_streamname( FALSE, name ))) return ERROR_OUTOFMEMORY;
639 
640  hr = IStorage_CreateStream( db->storage, encname, STGM_WRITE|STGM_SHARE_EXCLUSIVE, 0, 0, &stream );
641  if (SUCCEEDED( hr ))
642  {
643  hr = write_stream( stream, db->streams[i].stream );
644  if (FAILED( hr ))
645  {
646  ERR("failed to write stream %s (hr = %08x)\n", debugstr_w(encname), hr);
647  msi_free( encname );
648  IStream_Release( stream );
649  return ERROR_FUNCTION_FAILED;
650  }
651  hr = IStream_Commit( stream, 0 );
652  IStream_Release( stream );
653  if (FAILED( hr ))
654  {
655  ERR("failed to commit stream %s (hr = %08x)\n", debugstr_w(encname), hr);
656  msi_free( encname );
657  return ERROR_FUNCTION_FAILED;
658  }
659  }
660  else if (hr != STG_E_FILEALREADYEXISTS)
661  {
662  ERR("failed to create stream %s (hr = %08x)\n", debugstr_w(encname), hr);
663  msi_free( encname );
664  return ERROR_FUNCTION_FAILED;
665  }
666  msi_free( encname );
667  }
668 
669  return ERROR_SUCCESS;
670 }
const WCHAR * msi_string_lookup(const string_table *st, UINT id, int *len) DECLSPEC_HIDDEN
Definition: string.c:347
MSISTREAM * streams
Definition: msipriv.h:109
#define ERROR_SUCCESS
Definition: deptool.c:10
HRESULT hr
Definition: shlfolder.c:183
#define STGM_SHARE_EXCLUSIVE
Definition: objbase.h:922
static HRESULT write_stream(IStream *dst, IStream *src)
Definition: streams.c:581
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 ERROR_FUNCTION_FAILED
Definition: winerror.h:985
string_table * strings
Definition: msipriv.h:99
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
#define STGM_WRITE
Definition: objbase.h:917
IStream * stream
Definition: msipriv.h:86
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
#define STG_E_FILEALREADYEXISTS
Definition: winerror.h:2579
LPWSTR encode_streamname(BOOL bTable, LPCWSTR in) DECLSPEC_HIDDEN
Definition: table.c:128
Definition: parse.h:22
GLuint GLuint stream
Definition: glext.h:7522
#define ERR(fmt,...)
Definition: debug.h:109
UINT str_index
Definition: msipriv.h:85
unsigned int UINT
Definition: ndis.h:50
static BOOL msi_free(void *mem)
Definition: msipriv.h:1227
Definition: name.c:38
UINT num_streams
Definition: msipriv.h:110
IStorage * storage
Definition: msipriv.h:98
#define SUCCEEDED(hr)
Definition: intsafe.h:57
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13
GLuint const GLchar * name
Definition: glext.h:6031

Referenced by MsiDatabaseCommit().

◆ msi_get_stream()

UINT msi_get_stream ( MSIDATABASE db,
const WCHAR name,
IStream **  ret 
)

Definition at line 518 of file streams.c.

519 {
520  MSISTREAM *stream;
521  WCHAR *encname;
522  HRESULT hr;
523  UINT r;
524 
525  if ((stream = find_stream( db, name )))
526  {
528 
529  pos.QuadPart = 0;
530  hr = IStream_Seek( stream->stream, pos, STREAM_SEEK_SET, NULL );
531  if (FAILED( hr ))
532  return ERROR_FUNCTION_FAILED;
533 
534  *ret = stream->stream;
535  IStream_AddRef( *ret );
536  return ERROR_SUCCESS;
537  }
538 
539  if (!(encname = encode_streamname( FALSE, name )))
540  return ERROR_OUTOFMEMORY;
541 
542  hr = open_stream( db, encname, ret );
543  msi_free( encname );
544  if (FAILED( hr ))
545  return ERROR_FUNCTION_FAILED;
546 
547  r = append_stream( db, name, *ret );
548  if (r != ERROR_SUCCESS)
549  {
550  IStream_Release( *ret );
551  return r;
552  }
553 
554  IStream_AddRef( *ret );
555  return ERROR_SUCCESS;
556 }
#define ERROR_SUCCESS
Definition: deptool.c:10
HRESULT hr
Definition: shlfolder.c:183
static MSISTREAM * find_stream(MSIDATABASE *db, const WCHAR *name)
Definition: streams.c:435
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static HRESULT open_stream(MSIDATABASE *db, const WCHAR *name, IStream **stream)
Definition: streams.c:416
#define ERROR_FUNCTION_FAILED
Definition: winerror.h:985
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
LPWSTR encode_streamname(BOOL bTable, LPCWSTR in) DECLSPEC_HIDDEN
Definition: table.c:128
int ret
Definition: parse.h:22
GLuint GLuint stream
Definition: glext.h:7522
unsigned int UINT
Definition: ndis.h:50
static UINT append_stream(MSIDATABASE *db, const WCHAR *name, IStream *stream)
Definition: streams.c:450
static BOOL msi_free(void *mem)
Definition: msipriv.h:1227
Definition: name.c:38
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13

Referenced by cabinet_open_stream(), msi_get_db_suminfo(), and TABLE_fetch_stream().

◆ open_stream()

static HRESULT open_stream ( MSIDATABASE db,
const WCHAR name,
IStream **  stream 
)
static

Definition at line 416 of file streams.c.

417 {
418  HRESULT hr;
419 
420  hr = IStorage_OpenStream( db->storage, name, NULL, STGM_READ|STGM_SHARE_EXCLUSIVE, 0, stream );
421  if (FAILED( hr ))
422  {
424 
426  {
427  hr = IStorage_OpenStream( transform->stg, name, NULL, STGM_READ|STGM_SHARE_EXCLUSIVE, 0, stream );
428  if (SUCCEEDED( hr ))
429  break;
430  }
431  }
432  return hr;
433 }
HRESULT hr
Definition: shlfolder.c:183
#define STGM_SHARE_EXCLUSIVE
Definition: objbase.h:922
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
smooth NULL
Definition: ftsmooth.c:416
#define STGM_READ
Definition: objbase.h:916
LONG HRESULT
Definition: typedefs.h:77
Definition: parse.h:22
uint32_t entry
Definition: isohybrid.c:63
Definition: name.c:38
GLuint GLenum GLenum transform
Definition: glext.h:9407
IStorage * storage
Definition: msipriv.h:98
struct list transforms
Definition: msipriv.h:108
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by load_streams(), and msi_get_stream().

◆ STREAMS_close()

static UINT STREAMS_close ( struct tagMSIVIEW view)
static

Definition at line 242 of file streams.c.

243 {
244  TRACE("(%p)\n", view);
245  return ERROR_SUCCESS;
246 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define TRACE(s)
Definition: solgame.cpp:4

◆ STREAMS_CreateView()

UINT STREAMS_CreateView ( MSIDATABASE db,
MSIVIEW **  view 
)

Definition at line 558 of file streams.c.

559 {
560  MSISTREAMSVIEW *sv;
561  UINT r;
562 
563  TRACE("(%p, %p)\n", db, view);
564 
565  r = load_streams( db );
566  if (r != ERROR_SUCCESS)
567  return r;
568 
569  if (!(sv = msi_alloc_zero( sizeof(MSISTREAMSVIEW) )))
570  return ERROR_OUTOFMEMORY;
571 
572  sv->view.ops = &streams_ops;
574  sv->db = db;
575 
576  *view = (MSIVIEW *)sv;
577 
578  return ERROR_SUCCESS;
579 }
MSIDATABASE * db
Definition: streams.c:45
#define ERROR_SUCCESS
Definition: deptool.c:10
static const MSIVIEWOPS streams_ops
Definition: streams.c:393
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static void * msi_alloc_zero(size_t len) __WINE_ALLOC_SIZE(1)
Definition: msipriv.h:1210
#define NUM_STREAMS_COLS
Definition: streams.c:40
#define TRACE(s)
Definition: solgame.cpp:4
const MSIVIEWOPS * ops
Definition: msipriv.h:348
unsigned int UINT
Definition: ndis.h:50
static UINT load_streams(MSIDATABASE *db)
Definition: streams.c:465
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13
MSIVIEW view
Definition: streams.c:44

Referenced by TABLE_CreateView().

◆ STREAMS_delete()

static UINT STREAMS_delete ( struct tagMSIVIEW view)
static

Definition at line 354 of file streams.c.

355 {
357 
358  TRACE("(%p)\n", view);
359 
360  msi_free(sv);
361  return ERROR_SUCCESS;
362 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define TRACE(s)
Definition: solgame.cpp:4
static BOOL msi_free(void *mem)
Definition: msipriv.h:1227

◆ STREAMS_delete_row()

static UINT STREAMS_delete_row ( struct tagMSIVIEW view,
UINT  row 
)
static

Definition at line 209 of file streams.c.

210 {
211  MSIDATABASE *db = ((MSISTREAMSVIEW *)view)->db;
212  UINT i, num_rows = db->num_streams - 1;
213  const WCHAR *name;
214  WCHAR *encname;
215  HRESULT hr;
216 
217  TRACE("(%p %d)!\n", view, row);
218 
220  if (!(encname = encode_streamname( FALSE, name ))) return ERROR_OUTOFMEMORY;
221  hr = IStorage_DestroyElement( db->storage, encname );
222  msi_free( encname );
223  if (FAILED( hr ))
224  return ERROR_FUNCTION_FAILED;
225  hr = IStream_Release( db->streams[row].stream );
226  if (FAILED( hr ))
227  return ERROR_FUNCTION_FAILED;
228 
229  for (i = row; i < num_rows; i++)
230  db->streams[i] = db->streams[i + 1];
231  db->num_streams = num_rows;
232 
233  return ERROR_SUCCESS;
234 }
const WCHAR * msi_string_lookup(const string_table *st, UINT id, int *len) DECLSPEC_HIDDEN
Definition: string.c:347
MSISTREAM * streams
Definition: msipriv.h:109
#define ERROR_SUCCESS
Definition: deptool.c:10
HRESULT hr
Definition: shlfolder.c:183
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 ERROR_FUNCTION_FAILED
Definition: winerror.h:985
string_table * strings
Definition: msipriv.h:99
smooth NULL
Definition: ftsmooth.c:416
IStream * stream
Definition: msipriv.h:86
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
LPWSTR encode_streamname(BOOL bTable, LPCWSTR in) DECLSPEC_HIDDEN
Definition: table.c:128
int JSAMPARRAY int int num_rows
Definition: jpegint.h:412
UINT str_index
Definition: msipriv.h:85
unsigned int UINT
Definition: ndis.h:50
static BOOL msi_free(void *mem)
Definition: msipriv.h:1227
Definition: name.c:38
UINT num_streams
Definition: msipriv.h:110
IStorage * storage
Definition: msipriv.h:98
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13
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
GLuint const GLchar * name
Definition: glext.h:6031

Referenced by STREAMS_modify().

◆ STREAMS_execute()

static UINT STREAMS_execute ( struct tagMSIVIEW view,
MSIRECORD record 
)
static

Definition at line 236 of file streams.c.

237 {
238  TRACE("(%p, %p)\n", view, record);
239  return ERROR_SUCCESS;
240 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define TRACE(s)
Definition: solgame.cpp:4

◆ STREAMS_fetch_int()

static UINT STREAMS_fetch_int ( struct tagMSIVIEW view,
UINT  row,
UINT  col,
UINT val 
)
static

Definition at line 68 of file streams.c.

69 {
71 
72  TRACE("(%p, %d, %d, %p)\n", view, row, col, val);
73 
74  if (col != 1)
76 
77  if (row >= sv->db->num_streams)
78  return ERROR_NO_MORE_ITEMS;
79 
80  *val = sv->db->streams[row].str_index;
81 
82  return ERROR_SUCCESS;
83 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
MSISTREAM * streams
Definition: msipriv.h:109
MSIDATABASE * db
Definition: streams.c:45
#define ERROR_SUCCESS
Definition: deptool.c:10
#define ERROR_NO_MORE_ITEMS
Definition: compat.h:95
GLuint GLfloat * val
Definition: glext.h:7180
#define TRACE(s)
Definition: solgame.cpp:4
UINT str_index
Definition: msipriv.h:85
UINT num_streams
Definition: msipriv.h:110
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 streams_find_row().

◆ STREAMS_fetch_stream()

static UINT STREAMS_fetch_stream ( struct tagMSIVIEW view,
UINT  row,
UINT  col,
IStream **  stm 
)
static

Definition at line 85 of file streams.c.

86 {
89  HRESULT hr;
90 
91  TRACE("(%p, %d, %d, %p)\n", view, row, col, stm);
92 
93  if (row >= sv->db->num_streams)
94  return ERROR_FUNCTION_FAILED;
95 
96  pos.QuadPart = 0;
97  hr = IStream_Seek( sv->db->streams[row].stream, pos, STREAM_SEEK_SET, NULL );
98  if (FAILED( hr ))
99  return ERROR_FUNCTION_FAILED;
100 
101  *stm = sv->db->streams[row].stream;
102  IStream_AddRef( *stm );
103 
104  return ERROR_SUCCESS;
105 }
MSISTREAM * streams
Definition: msipriv.h:109
MSIDATABASE * db
Definition: streams.c:45
#define ERROR_SUCCESS
Definition: deptool.c:10
HRESULT hr
Definition: shlfolder.c:183
#define ERROR_FUNCTION_FAILED
Definition: winerror.h:985
smooth NULL
Definition: ftsmooth.c:416
IStream * stream
Definition: msipriv.h:86
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
UINT num_streams
Definition: msipriv.h:110
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

◆ STREAMS_find_matching_rows()

static UINT STREAMS_find_matching_rows ( struct tagMSIVIEW view,
UINT  col,
UINT  val,
UINT row,
MSIITERHANDLE handle 
)
static

Definition at line 364 of file streams.c.

366 {
369 
370  TRACE("(%p, %d, %d, %p, %p)\n", view, col, val, row, handle);
371 
372  if (!col || col > sv->num_cols)
374 
375  while (index < sv->db->num_streams)
376  {
377  if (sv->db->streams[index].str_index == val)
378  {
379  *row = index;
380  break;
381  }
382  index++;
383  }
384 
385  *handle = UlongToPtr(++index);
386 
387  if (index > sv->db->num_streams)
388  return ERROR_NO_MORE_ITEMS;
389 
390  return ERROR_SUCCESS;
391 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
MSISTREAM * streams
Definition: msipriv.h:109
MSIDATABASE * db
Definition: streams.c:45
#define ERROR_SUCCESS
Definition: deptool.c:10
#define ERROR_NO_MORE_ITEMS
Definition: compat.h:95
GLuint index
Definition: glext.h:6031
#define UlongToPtr(u)
Definition: config.h:106
#define PtrToUlong(u)
Definition: config.h:107
GLuint GLfloat * val
Definition: glext.h:7180
#define TRACE(s)
Definition: solgame.cpp:4
#define index(s, c)
Definition: various.h:29
UINT str_index
Definition: msipriv.h:85
unsigned int UINT
Definition: ndis.h:50
UINT num_streams
Definition: msipriv.h:110
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

◆ streams_find_row()

static UINT streams_find_row ( MSISTREAMSVIEW sv,
MSIRECORD rec,
UINT row 
)
static

Definition at line 155 of file streams.c.

156 {
157  const WCHAR *str;
158  UINT r, i, id, val;
159 
160  str = MSI_RecordGetString( rec, 1 );
161  r = msi_string2id( sv->db->strings, str, -1, &id );
162  if (r != ERROR_SUCCESS)
163  return r;
164 
165  for (i = 0; i < sv->db->num_streams; i++)
166  {
167  STREAMS_fetch_int( &sv->view, i, 1, &val );
168 
169  if (val == id)
170  {
171  if (row) *row = i;
172  return ERROR_SUCCESS;
173  }
174  }
175 
176  return ERROR_FUNCTION_FAILED;
177 }
MSIDATABASE * db
Definition: streams.c:45
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
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 ERROR_FUNCTION_FAILED
Definition: winerror.h:985
string_table * strings
Definition: msipriv.h:99
const WCHAR * str
const WCHAR * MSI_RecordGetString(const MSIRECORD *, UINT) DECLSPEC_HIDDEN
Definition: record.c:482
GLuint GLfloat * val
Definition: glext.h:7180
__wchar_t WCHAR
Definition: xmlstorage.h:180
UINT msi_string2id(const string_table *st, const WCHAR *data, int len, UINT *id) DECLSPEC_HIDDEN
Definition: string.c:404
static UINT STREAMS_fetch_int(struct tagMSIVIEW *view, UINT row, UINT col, UINT *val)
Definition: streams.c:68
unsigned int UINT
Definition: ndis.h:50
UINT num_streams
Definition: msipriv.h:110
GLenum GLuint id
Definition: glext.h:5579
MSIVIEW view
Definition: streams.c:44
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 STREAMS_insert_row(), streams_modify_assign(), and streams_modify_update().

◆ STREAMS_get_column_info()

static UINT STREAMS_get_column_info ( struct tagMSIVIEW view,
UINT  n,
LPCWSTR name,
UINT type,
BOOL temporary,
LPCWSTR table_name 
)
static

Definition at line 260 of file streams.c.

262 {
264 
265  TRACE("(%p, %d, %p, %p, %p, %p)\n", view, n, name, type, temporary, table_name);
266 
267  if (!n || n > sv->num_cols)
269 
270  switch (n)
271  {
272  case 1:
273  if (name) *name = szName;
275  break;
276 
277  case 2:
278  if (name) *name = szData;
280  break;
281  }
282  if (table_name) *table_name = szStreams;
283  if (temporary) *temporary = FALSE;
284  return ERROR_SUCCESS;
285 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define ERROR_SUCCESS
Definition: deptool.c:10
static const WCHAR szData[]
Definition: msipriv.h:1195
GLdouble n
Definition: glext.h:7729
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define MSITYPE_STRING
Definition: msipriv.h:47
#define MSITYPE_NULLABLE
Definition: msipriv.h:48
#define TRACE(s)
Definition: solgame.cpp:4
#define MAX_STREAM_NAME_LEN
Definition: msipriv.h:53
#define MSITYPE_VALID
Definition: msipriv.h:45
static const WCHAR szStreams[]
Definition: msipriv.h:1178
Definition: name.c:38
static const WCHAR szName[]
Definition: msipriv.h:1194

◆ STREAMS_get_dimensions()

static UINT STREAMS_get_dimensions ( struct tagMSIVIEW view,
UINT rows,
UINT cols 
)
static

Definition at line 248 of file streams.c.

249 {
251 
252  TRACE("(%p, %p, %p)\n", view, rows, cols);
253 
254  if (cols) *cols = sv->num_cols;
255  if (rows) *rows = sv->db->num_streams;
256 
257  return ERROR_SUCCESS;
258 }
MSIDATABASE * db
Definition: streams.c:45
#define ERROR_SUCCESS
Definition: deptool.c:10
#define TRACE(s)
Definition: solgame.cpp:4
UINT num_streams
Definition: msipriv.h:110

◆ STREAMS_get_row()

static UINT STREAMS_get_row ( struct tagMSIVIEW view,
UINT  row,
MSIRECORD **  rec 
)
static

Definition at line 107 of file streams.c.

108 {
110 
111  TRACE("%p %d %p\n", sv, row, rec);
112 
113  return msi_view_get_row( sv->db, view, row, rec );
114 }
MSIDATABASE * db
Definition: streams.c:45
#define TRACE(s)
Definition: solgame.cpp:4
UINT msi_view_get_row(MSIDATABASE *, MSIVIEW *, UINT, MSIRECORD **) DECLSPEC_HIDDEN
Definition: msiquery.c:287
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

◆ STREAMS_insert_row()

static UINT STREAMS_insert_row ( struct tagMSIVIEW view,
MSIRECORD rec,
UINT  row,
BOOL  temporary 
)
static

Definition at line 179 of file streams.c.

180 {
182  UINT i, r, num_rows = sv->db->num_streams + 1;
183 
184  TRACE("(%p, %p, %d, %d)\n", view, rec, row, temporary);
185 
186  r = streams_find_row( sv, rec, NULL );
187  if (r == ERROR_SUCCESS)
188  return ERROR_FUNCTION_FAILED;
189 
190  if (!streams_resize_table( sv->db, num_rows ))
191  return ERROR_FUNCTION_FAILED;
192 
193  if (row == -1)
194  row = num_rows - 1;
195 
196  /* shift the rows to make room for the new row */
197  for (i = num_rows - 1; i > row; i--)
198  {
199  sv->db->streams[i] = sv->db->streams[i - 1];
200  }
201 
202  r = STREAMS_set_row( view, row, rec, (1 << sv->num_cols) - 1 );
203  if (r == ERROR_SUCCESS)
204  sv->db->num_streams = num_rows;
205 
206  return r;
207 }
MSISTREAM * streams
Definition: msipriv.h:109
MSIDATABASE * db
Definition: streams.c:45
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static UINT STREAMS_set_row(struct tagMSIVIEW *view, UINT row, MSIRECORD *rec, UINT mask)
Definition: streams.c:116
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 ERROR_FUNCTION_FAILED
Definition: winerror.h:985
static UINT streams_find_row(MSISTREAMSVIEW *sv, MSIRECORD *rec, UINT *row)
Definition: streams.c:155
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
int JSAMPARRAY int int num_rows
Definition: jpegint.h:412
unsigned int UINT
Definition: ndis.h:50
UINT num_streams
Definition: msipriv.h:110
static BOOL streams_resize_table(MSIDATABASE *db, UINT size)
Definition: streams.c:49
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 STREAMS_modify(), and streams_modify_assign().

◆ STREAMS_modify()

static UINT STREAMS_modify ( struct tagMSIVIEW view,
MSIMODIFY  eModifyMode,
MSIRECORD rec,
UINT  row 
)
static

Definition at line 311 of file streams.c.

312 {
313  UINT r;
314 
315  TRACE("%p %d %p\n", view, eModifyMode, rec);
316 
317  switch (eModifyMode)
318  {
319  case MSIMODIFY_ASSIGN:
320  r = streams_modify_assign(view, rec);
321  break;
322 
323  case MSIMODIFY_INSERT:
324  r = STREAMS_insert_row(view, rec, -1, FALSE);
325  break;
326 
327  case MSIMODIFY_UPDATE:
328  r = streams_modify_update(view, rec);
329  break;
330 
331  case MSIMODIFY_DELETE:
332  r = STREAMS_delete_row(view, row - 1);
333  break;
334 
337  case MSIMODIFY_REFRESH:
338  case MSIMODIFY_REPLACE:
339  case MSIMODIFY_MERGE:
340  case MSIMODIFY_VALIDATE:
343  FIXME("%p %d %p - mode not implemented\n", view, eModifyMode, rec );
345  break;
346 
347  default:
349  }
350 
351  return r;
352 }
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define FIXME(fmt,...)
Definition: debug.h:110
#define TRACE(s)
Definition: solgame.cpp:4
#define ERROR_INVALID_DATA
Definition: winerror.h:116
static UINT streams_modify_assign(struct tagMSIVIEW *view, MSIRECORD *rec)
Definition: streams.c:299
unsigned int UINT
Definition: ndis.h:50
static UINT STREAMS_insert_row(struct tagMSIVIEW *view, MSIRECORD *rec, UINT row, BOOL temporary)
Definition: streams.c:179
static UINT streams_modify_update(struct tagMSIVIEW *view, MSIRECORD *rec)
Definition: streams.c:287
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92
static UINT STREAMS_delete_row(struct tagMSIVIEW *view, UINT row)
Definition: streams.c:209
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

◆ streams_modify_assign()

static UINT streams_modify_assign ( struct tagMSIVIEW view,
MSIRECORD rec 
)
static

Definition at line 299 of file streams.c.

300 {
302  UINT r;
303 
304  r = streams_find_row( sv, rec, NULL );
305  if (r == ERROR_SUCCESS)
306  return streams_modify_update(view, rec);
307 
308  return STREAMS_insert_row(view, rec, -1, FALSE);
309 }
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static UINT streams_find_row(MSISTREAMSVIEW *sv, MSIRECORD *rec, UINT *row)
Definition: streams.c:155
smooth NULL
Definition: ftsmooth.c:416
unsigned int UINT
Definition: ndis.h:50
static UINT STREAMS_insert_row(struct tagMSIVIEW *view, MSIRECORD *rec, UINT row, BOOL temporary)
Definition: streams.c:179
static UINT streams_modify_update(struct tagMSIVIEW *view, MSIRECORD *rec)
Definition: streams.c:287

Referenced by STREAMS_modify().

◆ streams_modify_update()

static UINT streams_modify_update ( struct tagMSIVIEW view,
MSIRECORD rec 
)
static

Definition at line 287 of file streams.c.

288 {
290  UINT r, row;
291 
292  r = streams_find_row(sv, rec, &row);
293  if (r != ERROR_SUCCESS)
294  return ERROR_FUNCTION_FAILED;
295 
296  return STREAMS_set_row( view, row, rec, (1 << sv->num_cols) - 1 );
297 }
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static UINT STREAMS_set_row(struct tagMSIVIEW *view, UINT row, MSIRECORD *rec, UINT mask)
Definition: streams.c:116
#define ERROR_FUNCTION_FAILED
Definition: winerror.h:985
static UINT streams_find_row(MSISTREAMSVIEW *sv, MSIRECORD *rec, UINT *row)
Definition: streams.c:155
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

Referenced by STREAMS_modify(), and streams_modify_assign().

◆ streams_resize_table()

static BOOL streams_resize_table ( MSIDATABASE db,
UINT  size 
)
static

Definition at line 49 of file streams.c.

50 {
51  if (!db->num_streams_allocated)
52  {
53  if (!(db->streams = msi_alloc_zero( size * sizeof(MSISTREAM) ))) return FALSE;
55  return TRUE;
56  }
57  while (size >= db->num_streams_allocated)
58  {
59  MSISTREAM *tmp;
60  UINT new_size = db->num_streams_allocated * 2;
61  if (!(tmp = msi_realloc_zero( db->streams, new_size * sizeof(MSISTREAM) ))) return FALSE;
62  db->streams = tmp;
63  db->num_streams_allocated = new_size;
64  }
65  return TRUE;
66 }
MSISTREAM * streams
Definition: msipriv.h:109
#define TRUE
Definition: types.h:120
UINT num_streams_allocated
Definition: msipriv.h:111
static void * msi_alloc_zero(size_t len) __WINE_ALLOC_SIZE(1)
Definition: msipriv.h:1210
GLsizeiptr size
Definition: glext.h:5919
unsigned int UINT
Definition: ndis.h:50
static void * msi_realloc_zero(void *mem, size_t len) __WINE_ALLOC_SIZE(2)
Definition: msipriv.h:1222

Referenced by append_stream(), and STREAMS_insert_row().

◆ STREAMS_set_row()

static UINT STREAMS_set_row ( struct tagMSIVIEW view,
UINT  row,
MSIRECORD rec,
UINT  mask 
)
static

Definition at line 116 of file streams.c.

117 {
119 
120  TRACE("(%p, %d, %p, %08x)\n", view, row, rec, mask);
121 
122  if (row > sv->db->num_streams || mask >= (1 << sv->num_cols))
124 
125  if (mask & 1)
126  {
127  const WCHAR *name = MSI_RecordGetString( rec, 1 );
128 
129  if (!name) return ERROR_INVALID_PARAMETER;
131  }
132  if (mask & 2)
133  {
134  IStream *old, *new;
135  HRESULT hr;
136  UINT r;
137 
138  r = MSI_RecordGetIStream( rec, 2, &new );
139  if (r != ERROR_SUCCESS)
140  return r;
141 
142  old = sv->db->streams[row].stream;
143  hr = IStream_QueryInterface( new, &IID_IStream, (void **)&sv->db->streams[row].stream );
144  if (FAILED( hr ))
145  {
146  IStream_Release( new );
147  return ERROR_FUNCTION_FAILED;
148  }
149  if (old) IStream_Release( old );
150  }
151 
152  return ERROR_SUCCESS;
153 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
MSISTREAM * streams
Definition: msipriv.h:109
MSIDATABASE * db
Definition: streams.c:45
#define ERROR_SUCCESS
Definition: deptool.c:10
HRESULT hr
Definition: shlfolder.c:183
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
UINT MSI_RecordGetIStream(MSIRECORD *, UINT, IStream **) DECLSPEC_HIDDEN
Definition: record.c:905
BOOL msi_add_string(string_table *st, const WCHAR *data, int len, enum StringPersistence persistence) DECLSPEC_HIDDEN
Definition: string.c:307
GLenum GLint GLuint mask
Definition: glext.h:6028
#define ERROR_FUNCTION_FAILED
Definition: winerror.h:985
string_table * strings
Definition: msipriv.h:99
const WCHAR * MSI_RecordGetString(const MSIRECORD *, UINT) DECLSPEC_HIDDEN
Definition: record.c:482
IStream * stream
Definition: msipriv.h:86
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
UINT str_index
Definition: msipriv.h:85
unsigned int UINT
Definition: ndis.h:50
Definition: name.c:38
UINT num_streams
Definition: msipriv.h:110
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 STREAMS_insert_row(), and streams_modify_update().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( msidb  )

◆ write_stream()

static HRESULT write_stream ( IStream dst,
IStream src 
)
static

Definition at line 581 of file streams.c.

582 {
583  HRESULT hr;
584  char buf[4096];
585  STATSTG stat;
587  UINT count, size;
588 
589  hr = IStream_Stat( src, &stat, STATFLAG_NONAME );
590  if (FAILED( hr )) return hr;
591 
592  hr = IStream_SetSize( dst, stat.cbSize );
593  if (FAILED( hr )) return hr;
594 
595  pos.QuadPart = 0;
596  hr = IStream_Seek( dst, pos, STREAM_SEEK_SET, NULL );
597  if (FAILED( hr )) return hr;
598 
599  for (;;)
600  {
601  size = min( sizeof(buf), stat.cbSize.QuadPart );
602  hr = IStream_Read( src, buf, size, &count );
603  if (FAILED( hr ) || count != size)
604  {
605  WARN("failed to read stream: %08x\n", hr);
606  return E_INVALIDARG;
607  }
608  stat.cbSize.QuadPart -= count;
609  if (count)
610  {
611  size = count;
612  hr = IStream_Write( dst, buf, size, &count );
613  if (FAILED( hr ) || count != size)
614  {
615  WARN("failed to write stream: %08x\n", hr);
616  return E_INVALIDARG;
617  }
618  }
619  if (!stat.cbSize.QuadPart) break;
620  }
621 
622  return S_OK;
623 }
HRESULT hr
Definition: shlfolder.c:183
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define WARN(fmt,...)
Definition: debug.h:111
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
GLsizeiptr size
Definition: glext.h:5919
LONG HRESULT
Definition: typedefs.h:77
Definition: stat.h:55
GLenum src
Definition: glext.h:6340
_CRTIMP int __cdecl stat(const char *_Filename, struct stat *_Stat)
Definition: stat.h:345
#define S_OK
Definition: intsafe.h:59
GLenum GLenum dst
Definition: glext.h:6340
#define min(a, b)
Definition: monoChain.cc:55
unsigned int UINT
Definition: ndis.h:50

Referenced by msi_commit_streams().

Variable Documentation

◆ streams_ops

const MSIVIEWOPS streams_ops
static
Initial value:
=
{
}
static UINT STREAMS_modify(struct tagMSIVIEW *view, MSIMODIFY eModifyMode, MSIRECORD *rec, UINT row)
Definition: streams.c:311
static UINT STREAMS_find_matching_rows(struct tagMSIVIEW *view, UINT col, UINT val, UINT *row, MSIITERHANDLE *handle)
Definition: streams.c:364
static UINT STREAMS_set_row(struct tagMSIVIEW *view, UINT row, MSIRECORD *rec, UINT mask)
Definition: streams.c:116
smooth NULL
Definition: ftsmooth.c:416
static UINT STREAMS_execute(struct tagMSIVIEW *view, MSIRECORD *record)
Definition: streams.c:236
static UINT STREAMS_get_dimensions(struct tagMSIVIEW *view, UINT *rows, UINT *cols)
Definition: streams.c:248
static UINT STREAMS_get_column_info(struct tagMSIVIEW *view, UINT n, LPCWSTR *name, UINT *type, BOOL *temporary, LPCWSTR *table_name)
Definition: streams.c:260
static UINT STREAMS_fetch_int(struct tagMSIVIEW *view, UINT row, UINT col, UINT *val)
Definition: streams.c:68
static UINT STREAMS_fetch_stream(struct tagMSIVIEW *view, UINT row, UINT col, IStream **stm)
Definition: streams.c:85
static UINT STREAMS_insert_row(struct tagMSIVIEW *view, MSIRECORD *rec, UINT row, BOOL temporary)
Definition: streams.c:179
static UINT STREAMS_delete_row(struct tagMSIVIEW *view, UINT row)
Definition: streams.c:209
static UINT STREAMS_get_row(struct tagMSIVIEW *view, UINT row, MSIRECORD **rec)
Definition: streams.c:107
static UINT STREAMS_delete(struct tagMSIVIEW *view)
Definition: streams.c:354
static UINT STREAMS_close(struct tagMSIVIEW *view)
Definition: streams.c:242

Definition at line 393 of file streams.c.

Referenced by STREAMS_CreateView().