diff --git a/dlls/quartz/Makefile.in b/dlls/quartz/Makefile.in index 8361dbeb43b..2f93e21d385 100644 --- a/dlls/quartz/Makefile.in +++ b/dlls/quartz/Makefile.in @@ -9,6 +9,7 @@ LDDLLFLAGS = @LDDLLFLAGS@ SYMBOLFILE = $(MODULE).tmp.o C_SRCS = \ + amerror.c \ complist.c \ fgraph.c \ ibasaud.c \ diff --git a/dlls/quartz/amerror.c b/dlls/quartz/amerror.c new file mode 100644 index 00000000000..0f778c06df1 --- /dev/null +++ b/dlls/quartz/amerror.c @@ -0,0 +1,225 @@ + +#include "config.h" + +#include "windef.h" +#include "winbase.h" +#include "wingdi.h" +#include "winuser.h" +#include "winerror.h" +#include "winnls.h" +#include "wine/obj_base.h" +#include "strmif.h" +#include "errors.h" + +#include "debugtools.h" +DEFAULT_DEBUG_CHANNEL(quartz); + + +static +LPWSTR QUARTZ_strncpyAtoW( LPWSTR lpwstr, LPCSTR lpstr, INT wbuflen ) +{ + INT len; + + len = MultiByteToWideChar( CP_ACP, 0, lpstr, -1, lpwstr, wbuflen ); + if ( len == 0 ) + *lpwstr = 0; + return lpwstr; +} + + +static LPCSTR hresult_to_string( HRESULT hr ) +{ + switch ( hr ) + { + #define ENTRY(x) case x: return (const char*)#x; + /* some known codes */ + ENTRY(S_OK) + ENTRY(S_FALSE) + ENTRY(E_FAIL) + ENTRY(E_POINTER) + ENTRY(E_NOTIMPL) + ENTRY(E_NOINTERFACE) + ENTRY(E_OUTOFMEMORY) + ENTRY(CLASS_E_CLASSNOTAVAILABLE) + ENTRY(CLASS_E_NOAGGREGATION) + + /* vfwmsgs.h */ + ENTRY(VFW_S_NO_MORE_ITEMS) + ENTRY(VFW_E_BAD_KEY) + ENTRY(VFW_E_INVALIDMEDIATYPE) + ENTRY(VFW_E_INVALIDSUBTYPE) + ENTRY(VFW_E_NEED_OWNER) + ENTRY(VFW_E_ENUM_OUT_OF_SYNC) + ENTRY(VFW_E_ALREADY_CONNECTED) + ENTRY(VFW_E_FILTER_ACTIVE) + ENTRY(VFW_E_NO_TYPES) + ENTRY(VFW_E_NO_ACCEPTABLE_TYPES) + ENTRY(VFW_E_INVALID_DIRECTION) + ENTRY(VFW_E_NOT_CONNECTED) + ENTRY(VFW_E_NO_ALLOCATOR) + ENTRY(VFW_E_RUNTIME_ERROR) + ENTRY(VFW_E_BUFFER_NOTSET) + ENTRY(VFW_E_BUFFER_OVERFLOW) + ENTRY(VFW_E_BADALIGN) + ENTRY(VFW_E_ALREADY_COMMITTED) + ENTRY(VFW_E_BUFFERS_OUTSTANDING) + ENTRY(VFW_E_NOT_COMMITTED) + ENTRY(VFW_E_SIZENOTSET) + ENTRY(VFW_E_NO_CLOCK) + ENTRY(VFW_E_NO_SINK) + ENTRY(VFW_E_NO_INTERFACE) + ENTRY(VFW_E_NOT_FOUND) + ENTRY(VFW_E_CANNOT_CONNECT) + ENTRY(VFW_E_CANNOT_RENDER) + ENTRY(VFW_E_CHANGING_FORMAT) + ENTRY(VFW_E_NO_COLOR_KEY_SET) + ENTRY(VFW_E_NOT_OVERLAY_CONNECTION) + ENTRY(VFW_E_NOT_SAMPLE_CONNECTION) + ENTRY(VFW_E_PALETTE_SET) + ENTRY(VFW_E_COLOR_KEY_SET) + ENTRY(VFW_E_NO_COLOR_KEY_FOUND) + ENTRY(VFW_E_NO_PALETTE_AVAILABLE) + ENTRY(VFW_E_NO_DISPLAY_PALETTE) + ENTRY(VFW_E_TOO_MANY_COLORS) + ENTRY(VFW_E_STATE_CHANGED) + ENTRY(VFW_E_NOT_STOPPED) + ENTRY(VFW_E_NOT_PAUSED) + ENTRY(VFW_E_NOT_RUNNING) + ENTRY(VFW_E_WRONG_STATE) + ENTRY(VFW_E_START_TIME_AFTER_END) + ENTRY(VFW_E_INVALID_RECT) + ENTRY(VFW_E_TYPE_NOT_ACCEPTED) + ENTRY(VFW_E_SAMPLE_REJECTED) + ENTRY(VFW_E_SAMPLE_REJECTED_EOS) + ENTRY(VFW_S_DUPLICATE_NAME) + ENTRY(VFW_E_DUPLICATE_NAME) + ENTRY(VFW_E_TIMEOUT) + ENTRY(VFW_E_INVALID_FILE_FORMAT) + ENTRY(VFW_E_ENUM_OUT_OF_RANGE) + ENTRY(VFW_E_CIRCULAR_GRAPH) + ENTRY(VFW_E_NOT_ALLOWED_TO_SAVE) + ENTRY(VFW_E_TIME_ALREADY_PASSED) + ENTRY(VFW_E_ALREADY_CANCELLED) + ENTRY(VFW_E_CORRUPT_GRAPH_FILE) + ENTRY(VFW_E_ADVISE_ALREADY_SET) + ENTRY(VFW_S_STATE_INTERMEDIATE) + ENTRY(VFW_E_NO_MODEX_AVAILABLE) + ENTRY(VFW_E_NO_ADVISE_SET) + ENTRY(VFW_E_NO_FULLSCREEN) + ENTRY(VFW_E_IN_FULLSCREEN_MODE) + ENTRY(VFW_E_UNKNOWN_FILE_TYPE) + ENTRY(VFW_E_CANNOT_LOAD_SOURCE_FILTER) + ENTRY(VFW_S_PARTIAL_RENDER) + ENTRY(VFW_E_FILE_TOO_SHORT) + ENTRY(VFW_E_INVALID_FILE_VERSION) + ENTRY(VFW_S_SOME_DATA_IGNORED) + ENTRY(VFW_S_CONNECTIONS_DEFERRED) + ENTRY(VFW_E_INVALID_CLSID) + ENTRY(VFW_E_INVALID_MEDIA_TYPE) + ENTRY(VFW_E_SAMPLE_TIME_NOT_SET) + ENTRY(VFW_S_RESOURCE_NOT_NEEDED) + ENTRY(VFW_E_MEDIA_TIME_NOT_SET) + ENTRY(VFW_E_NO_TIME_FORMAT_SET) + ENTRY(VFW_E_MONO_AUDIO_HW) + ENTRY(VFW_S_MEDIA_TYPE_IGNORED) + ENTRY(VFW_E_NO_DECOMPRESSOR) + ENTRY(VFW_E_NO_AUDIO_HARDWARE) + ENTRY(VFW_S_VIDEO_NOT_RENDERED) + ENTRY(VFW_S_AUDIO_NOT_RENDERED) + ENTRY(VFW_E_RPZA) + ENTRY(VFW_S_RPZA) + ENTRY(VFW_E_PROCESSOR_NOT_SUITABLE) + ENTRY(VFW_E_UNSUPPORTED_AUDIO) + ENTRY(VFW_E_UNSUPPORTED_VIDEO) + ENTRY(VFW_E_MPEG_NOT_CONSTRAINED) + ENTRY(VFW_E_NOT_IN_GRAPH) + ENTRY(VFW_S_ESTIMATED) + ENTRY(VFW_E_NO_TIME_FORMAT) + ENTRY(VFW_E_READ_ONLY) + ENTRY(VFW_S_RESERVED) + ENTRY(VFW_E_BUFFER_UNDERFLOW) + ENTRY(VFW_E_UNSUPPORTED_STREAM) + ENTRY(VFW_E_NO_TRANSPORT) + ENTRY(VFW_S_STREAM_OFF) + ENTRY(VFW_S_CANT_CUE) + ENTRY(VFW_E_BAD_VIDEOCD) + ENTRY(VFW_S_NO_STOP_TIME) + ENTRY(VFW_E_OUT_OF_VIDEO_MEMORY) + ENTRY(VFW_E_VP_NEGOTIATION_FAILED) + ENTRY(VFW_E_DDRAW_CAPS_NOT_SUITABLE) + ENTRY(VFW_E_NO_VP_HARDWARE) + ENTRY(VFW_E_NO_CAPTURE_HARDWARE) + ENTRY(VFW_E_DVD_OPERATION_INHIBITED) + ENTRY(VFW_E_DVD_INVALIDDOMAIN) + ENTRY(VFW_E_DVD_NO_BUTTON) + ENTRY(VFW_E_DVD_GRAPHNOTREADY) + ENTRY(VFW_E_DVD_RENDERFAIL) + ENTRY(VFW_E_DVD_DECNOTENOUGH) + ENTRY(VFW_E_DDRAW_VERSION_NOT_SUITABLE) + ENTRY(VFW_E_COPYPROT_FAILED) + ENTRY(VFW_S_NOPREVIEWPIN) + ENTRY(VFW_E_TIME_EXPIRED) + ENTRY(VFW_S_DVD_NON_ONE_SEQUENTIAL) + ENTRY(VFW_E_DVD_WRONG_SPEED) + ENTRY(VFW_E_DVD_MENU_DOES_NOT_EXIST) + ENTRY(VFW_E_DVD_CMD_CANCELLED) + ENTRY(VFW_E_DVD_STATE_WRONG_VERSION) + ENTRY(VFW_E_DVD_STATE_CORRUPT) + ENTRY(VFW_E_DVD_STATE_WRONG_DISC) + ENTRY(VFW_E_DVD_INCOMPATIBLE_REGION) + ENTRY(VFW_E_DVD_NO_ATTRIBUTES) + ENTRY(VFW_E_DVD_NO_GOUP_PGC) + ENTRY(VFW_E_DVD_LOW_PARENTAL_LEVEL) + ENTRY(VFW_E_DVD_NOT_IN_KARAOKE_MODE) + ENTRY(VFW_S_DVD_CHANNEL_CONTENTS_NOT_AVAILABLE) + ENTRY(VFW_S_DVD_NOT_ACCURATE) + ENTRY(VFW_E_FRAME_STEP_UNSUPPORTED) + ENTRY(VFW_E_DVD_STREAM_DISABLED) + ENTRY(VFW_E_DVD_TITLE_UNKNOWN) + ENTRY(VFW_E_DVD_INVALID_DISC) + ENTRY(VFW_E_DVD_NO_RESUME_INFORMATION) + ENTRY(VFW_E_PIN_ALREADY_BLOCKED_ON_THIS_THREAD) + ENTRY(VFW_E_PIN_ALREADY_BLOCKED) + ENTRY(VFW_E_CERTIFICATION_FAILURE) + #undef ENTRY + } + + return NULL; +} + +/*********************************************************************** + * AMGetErrorTextA (quartz.@) + */ +DWORD WINAPI AMGetErrorTextA(HRESULT hr, LPSTR pszbuf, DWORD dwBufLen) +{ + LPCSTR lpszRes; + DWORD len; + + lpszRes = hresult_to_string( hr ); + if ( lpszRes == NULL ) + return 0; + len = (DWORD)(strlen(lpszRes)+1); + if ( len > dwBufLen ) + return 0; + + memcpy( pszbuf, lpszRes, len ); + return len; +} + +/*********************************************************************** + * AMGetErrorTextW (quartz.@) + */ +DWORD WINAPI AMGetErrorTextW(HRESULT hr, LPWSTR pwszbuf, DWORD dwBufLen) +{ + CHAR szBuf[MAX_ERROR_TEXT_LEN+1]; + DWORD dwLen; + + dwLen = AMGetErrorTextA(hr,szBuf,MAX_ERROR_TEXT_LEN); + if ( dwLen == 0 ) + return 0; + szBuf[dwLen] = 0; + + QUARTZ_strncpyAtoW( pwszbuf, szBuf, dwBufLen ); + + return lstrlenW( pwszbuf ); +} diff --git a/dlls/quartz/quartz.spec b/dlls/quartz/quartz.spec index 7afdbf6661b..d0d5c2e4a85 100644 --- a/dlls/quartz/quartz.spec +++ b/dlls/quartz/quartz.spec @@ -8,8 +8,8 @@ import ntdll.dll debug_channels (quartz) -@ stub AMGetErrorTextA -@ stub AMGetErrorTextW +@ stdcall AMGetErrorTextA(long ptr long) AMGetErrorTextA +@ stdcall AMGetErrorTextW(long ptr long) AMGetErrorTextW @ stub AmpFactorToDB @ stub DBToAmpFactor @ stdcall DllCanUnloadNow() QUARTZ_DllCanUnloadNow diff --git a/include/Makefile.in b/include/Makefile.in index 003c612d28a..273023719bb 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -33,6 +33,7 @@ INSTALLED_INCLUDES = \ dplobby.h \ dshow.h \ dsound.h \ + errors.h \ evcode.h \ guiddef.h \ imagehlp.h \ @@ -118,6 +119,7 @@ INSTALLED_INCLUDES = \ uuids.h \ ver.h \ vfw.h \ + vfwmsgs.h \ winbase.h \ wincon.h \ wincrypt.h \ diff --git a/include/errors.h b/include/errors.h new file mode 100644 index 00000000000..9ea1ce267c4 --- /dev/null +++ b/include/errors.h @@ -0,0 +1,20 @@ +#ifndef WINE_DSHOW_ERRORS_H +#define WINE_DSHOW_ERRORS_H + +#include "vfwmsgs.h" + +#define MAX_ERROR_TEXT_LEN 160 + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +DWORD WINAPI AMGetErrorTextA(HRESULT hr, LPSTR pszbuf, DWORD dwBufLen); +DWORD WINAPI AMGetErrorTextW(HRESULT hr, LPWSTR pwszbuf, DWORD dwBufLen); +#define AMGetErrorText WINELIB_NAME_AW(AMGetErrorText) + +#ifdef __cplusplus +} /* extern "C" */ +#endif /* __cplusplus */ + +#endif /* WINE_DSHOW_ERRORS_H */ diff --git a/include/vfwmsgs.h b/include/vfwmsgs.h new file mode 100644 index 00000000000..1d4731eb363 --- /dev/null +++ b/include/vfwmsgs.h @@ -0,0 +1,143 @@ +#ifndef WINE_DSHOW_VFWMSGS_H +#define WINE_DSHOW_VFWMSGS_H + +#define VFW_S_NO_MORE_ITEMS 0x00040103 +#define VFW_E_BAD_KEY 0x800403f2 + +#define VFW_E_INVALIDMEDIATYPE 0x80040200 +#define VFW_E_INVALIDSUBTYPE 0x80040201 +#define VFW_E_NEED_OWNER 0x80040202 +#define VFW_E_ENUM_OUT_OF_SYNC 0x80040203 +#define VFW_E_ALREADY_CONNECTED 0x80040204 +#define VFW_E_FILTER_ACTIVE 0x80040205 +#define VFW_E_NO_TYPES 0x80040206 +#define VFW_E_NO_ACCEPTABLE_TYPES 0x80040207 +#define VFW_E_INVALID_DIRECTION 0x80040208 +#define VFW_E_NOT_CONNECTED 0x80040209 +#define VFW_E_NO_ALLOCATOR 0x8004020a +#define VFW_E_RUNTIME_ERROR 0x8004020b +#define VFW_E_BUFFER_NOTSET 0x8004020c +#define VFW_E_BUFFER_OVERFLOW 0x8004020d +#define VFW_E_BADALIGN 0x8004020e +#define VFW_E_ALREADY_COMMITTED 0x8004020f +#define VFW_E_BUFFERS_OUTSTANDING 0x80040210 +#define VFW_E_NOT_COMMITTED 0x80040211 +#define VFW_E_SIZENOTSET 0x80040212 +#define VFW_E_NO_CLOCK 0x80040213 +#define VFW_E_NO_SINK 0x80040214 +#define VFW_E_NO_INTERFACE 0x80040215 +#define VFW_E_NOT_FOUND 0x80040216 +#define VFW_E_CANNOT_CONNECT 0x80040217 +#define VFW_E_CANNOT_RENDER 0x80040218 +#define VFW_E_CHANGING_FORMAT 0x80040219 +#define VFW_E_NO_COLOR_KEY_SET 0x8004021a +#define VFW_E_NOT_OVERLAY_CONNECTION 0x8004021b +#define VFW_E_NOT_SAMPLE_CONNECTION 0x8004021c +#define VFW_E_PALETTE_SET 0x8004021d +#define VFW_E_COLOR_KEY_SET 0x8004021e +#define VFW_E_NO_COLOR_KEY_FOUND 0x8004021f +#define VFW_E_NO_PALETTE_AVAILABLE 0x80040220 +#define VFW_E_NO_DISPLAY_PALETTE 0x80040221 +#define VFW_E_TOO_MANY_COLORS 0x80040222 +#define VFW_E_STATE_CHANGED 0x80040223 +#define VFW_E_NOT_STOPPED 0x80040224 +#define VFW_E_NOT_PAUSED 0x80040225 +#define VFW_E_NOT_RUNNING 0x80040226 +#define VFW_E_WRONG_STATE 0x80040227 +#define VFW_E_START_TIME_AFTER_END 0x80040228 +#define VFW_E_INVALID_RECT 0x80040229 +#define VFW_E_TYPE_NOT_ACCEPTED 0x8004022a +#define VFW_E_SAMPLE_REJECTED 0x8004022b +#define VFW_E_SAMPLE_REJECTED_EOS 0x8004022c +#define VFW_S_DUPLICATE_NAME 0x0004022d +#define VFW_E_DUPLICATE_NAME 0x8004022d +#define VFW_E_TIMEOUT 0x8004022e +#define VFW_E_INVALID_FILE_FORMAT 0x8004022f +#define VFW_E_ENUM_OUT_OF_RANGE 0x80040230 +#define VFW_E_CIRCULAR_GRAPH 0x80040231 +#define VFW_E_NOT_ALLOWED_TO_SAVE 0x80040232 +#define VFW_E_TIME_ALREADY_PASSED 0x80040233 +#define VFW_E_ALREADY_CANCELLED 0x80040234 +#define VFW_E_CORRUPT_GRAPH_FILE 0x80040235 +#define VFW_E_ADVISE_ALREADY_SET 0x80040236 +#define VFW_S_STATE_INTERMEDIATE 0x00040237 +#define VFW_E_NO_MODEX_AVAILABLE 0x80040238 +#define VFW_E_NO_ADVISE_SET 0x80040239 +#define VFW_E_NO_FULLSCREEN 0x8004023a +#define VFW_E_IN_FULLSCREEN_MODE 0x8004023b +#define VFW_E_UNKNOWN_FILE_TYPE 0x80040240 +#define VFW_E_CANNOT_LOAD_SOURCE_FILTER 0x80040241 +#define VFW_S_PARTIAL_RENDER 0x00040242 +#define VFW_E_FILE_TOO_SHORT 0x80040243 +#define VFW_E_INVALID_FILE_VERSION 0x80040244 +#define VFW_S_SOME_DATA_IGNORED 0x00040245 +#define VFW_S_CONNECTIONS_DEFERRED 0x00040246 +#define VFW_E_INVALID_CLSID 0x80040247 +#define VFW_E_INVALID_MEDIA_TYPE 0x80040248 +#define VFW_E_SAMPLE_TIME_NOT_SET 0x80040249 +#define VFW_S_RESOURCE_NOT_NEEDED 0x00040250 +#define VFW_E_MEDIA_TIME_NOT_SET 0x80040251 +#define VFW_E_NO_TIME_FORMAT_SET 0x80040252 +#define VFW_E_MONO_AUDIO_HW 0x80040253 +#define VFW_S_MEDIA_TYPE_IGNORED 0x00040254 +#define VFW_E_NO_DECOMPRESSOR 0x80040255 +#define VFW_E_NO_AUDIO_HARDWARE 0x80040256 +#define VFW_S_VIDEO_NOT_RENDERED 0x00040257 +#define VFW_S_AUDIO_NOT_RENDERED 0x00040258 +#define VFW_E_RPZA 0x80040259 +#define VFW_S_RPZA 0x0004025a +#define VFW_E_PROCESSOR_NOT_SUITABLE 0x8004025b +#define VFW_E_UNSUPPORTED_AUDIO 0x8004025c +#define VFW_E_UNSUPPORTED_VIDEO 0x8004025d +#define VFW_E_MPEG_NOT_CONSTRAINED 0x8004025e +#define VFW_E_NOT_IN_GRAPH 0x8004025f +#define VFW_S_ESTIMATED 0x00040260 +#define VFW_E_NO_TIME_FORMAT 0x80040261 +#define VFW_E_READ_ONLY 0x80040262 +#define VFW_S_RESERVED 0x00040263 +#define VFW_E_BUFFER_UNDERFLOW 0x80040264 +#define VFW_E_UNSUPPORTED_STREAM 0x80040265 +#define VFW_E_NO_TRANSPORT 0x80040266 +#define VFW_S_STREAM_OFF 0x00040267 +#define VFW_S_CANT_CUE 0x00040268 +#define VFW_E_BAD_VIDEOCD 0x80040269 +#define VFW_S_NO_STOP_TIME 0x00040270 +#define VFW_E_OUT_OF_VIDEO_MEMORY 0x80040271 +#define VFW_E_VP_NEGOTIATION_FAILED 0x80040272 +#define VFW_E_DDRAW_CAPS_NOT_SUITABLE 0x80040273 +#define VFW_E_NO_VP_HARDWARE 0x80040274 +#define VFW_E_NO_CAPTURE_HARDWARE 0x80040275 +#define VFW_E_DVD_OPERATION_INHIBITED 0x80040276 +#define VFW_E_DVD_INVALIDDOMAIN 0x80040277 +#define VFW_E_DVD_NO_BUTTON 0x80040278 +#define VFW_E_DVD_GRAPHNOTREADY 0x80040279 +#define VFW_E_DVD_RENDERFAIL 0x8004027a +#define VFW_E_DVD_DECNOTENOUGH 0x8004027b +#define VFW_E_DDRAW_VERSION_NOT_SUITABLE 0x8004027c +#define VFW_E_COPYPROT_FAILED 0x8004027d +#define VFW_S_NOPREVIEWPIN 0x0004027e +#define VFW_E_TIME_EXPIRED 0x8004027f +#define VFW_S_DVD_NON_ONE_SEQUENTIAL 0x00040280 +#define VFW_E_DVD_WRONG_SPEED 0x80040281 +#define VFW_E_DVD_MENU_DOES_NOT_EXIST 0x80040282 +#define VFW_E_DVD_CMD_CANCELLED 0x80040283 +#define VFW_E_DVD_STATE_WRONG_VERSION 0x80040284 +#define VFW_E_DVD_STATE_CORRUPT 0x80040285 +#define VFW_E_DVD_STATE_WRONG_DISC 0x80040286 +#define VFW_E_DVD_INCOMPATIBLE_REGION 0x80040287 +#define VFW_E_DVD_NO_ATTRIBUTES 0x80040288 +#define VFW_E_DVD_NO_GOUP_PGC 0x80040289 +#define VFW_E_DVD_LOW_PARENTAL_LEVEL 0x8004028a +#define VFW_E_DVD_NOT_IN_KARAOKE_MODE 0x8004028b +#define VFW_S_DVD_CHANNEL_CONTENTS_NOT_AVAILABLE 0x0004028c +#define VFW_S_DVD_NOT_ACCURATE 0x0004028d +#define VFW_E_FRAME_STEP_UNSUPPORTED 0x8004028e +#define VFW_E_DVD_STREAM_DISABLED 0x8004028f +#define VFW_E_DVD_TITLE_UNKNOWN 0x80040290 +#define VFW_E_DVD_INVALID_DISC 0x80040291 +#define VFW_E_DVD_NO_RESUME_INFORMATION 0x80040292 +#define VFW_E_PIN_ALREADY_BLOCKED_ON_THIS_THREAD 0x80040293 +#define VFW_E_PIN_ALREADY_BLOCKED 0x80040294 +#define VFW_E_CERTIFICATION_FAILURE 0x80040295 + +#endif /* WINE_DSHOW_VFWMSGS_H */