Christian Costa : d3dxof: Only consider 4 lowest bits in DXFILELOADOPTIONS + tests.

Alexandre Julliard julliard at winehq.org
Fri Oct 23 10:19:05 CDT 2009


Module: wine
Branch: master
Commit: c94763b4204cf10dd79af215aa51b5715dfd6c9d
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=c94763b4204cf10dd79af215aa51b5715dfd6c9d

Author: Christian Costa <titan.costa at wanadoo.fr>
Date:   Fri Oct 23 08:41:04 2009 +0200

d3dxof: Only consider 4 lowest bits in DXFILELOADOPTIONS + tests.

---

 dlls/d3dxof/d3dxof.c       |    3 ++
 dlls/d3dxof/tests/d3dxof.c |   54 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 57 insertions(+), 0 deletions(-)

diff --git a/dlls/d3dxof/d3dxof.c b/dlls/d3dxof/d3dxof.c
index 5d42d53..cd4690d 100644
--- a/dlls/d3dxof/d3dxof.c
+++ b/dlls/d3dxof/d3dxof.c
@@ -142,6 +142,9 @@ static HRESULT WINAPI IDirectXFileImpl_CreateEnumObject(IDirectXFile* iface, LPV
   if (!ppEnumObj)
     return DXFILEERR_BADVALUE;
 
+  /* Only lowest 4 bits are relevant in DXFILELOADOPTIONS */
+  dwLoadOptions &= 0xF;
+
   if (dwLoadOptions == DXFILELOAD_FROMFILE)
   {
     TRACE("Open source file '%s'\n", (char*)pvSource);
diff --git a/dlls/d3dxof/tests/d3dxof.c b/dlls/d3dxof/tests/d3dxof.c
index aec29b0..9f1295f 100644
--- a/dlls/d3dxof/tests/d3dxof.c
+++ b/dlls/d3dxof/tests/d3dxof.c
@@ -137,6 +137,59 @@ static void test_refcount(void)
     ok(ref == 0, "Got refcount %d, expected 0\n", ref);
 }
 
+static void test_CreateEnumObject(void)
+{
+    HRESULT hr;
+    ULONG ref;
+    LPDIRECTXFILE lpDirectXFile = NULL;
+    LPDIRECTXFILEENUMOBJECT lpdxfeo;
+    LPDIRECTXFILEDATA lpdxfd;
+    DXFILELOADMEMORY dxflm;
+    BYTE* pdata;
+    DWORD size;
+
+    if (!pDirectXFileCreate)
+    {
+        win_skip("DirectXFileCreate is not available\n");
+        return;
+    }
+
+    hr = pDirectXFileCreate(&lpDirectXFile);
+    ok(hr == DXFILE_OK, "DirectXFileCreate: %x\n", hr);
+    if(!lpDirectXFile)
+    {
+        skip("Couldn't create DirectXFile interface\n");
+        return;
+    }
+
+    hr = IDirectXFile_RegisterTemplates(lpDirectXFile, template, strlen(template));
+    ok(hr == DXFILE_OK, "IDirectXFileImpl_RegisterTemplates: %x\n", hr);
+
+    dxflm.lpMemory = &object;
+    dxflm.dSize = strlen(object);
+    /* Check that only lowest 4 bits are relevant in DXFILELOADOPTIONS */
+    hr = IDirectXFile_CreateEnumObject(lpDirectXFile, &dxflm, 0xFFFFFFF0 + DXFILELOAD_FROMMEMORY, &lpdxfeo);
+    ok(hr == DXFILE_OK, "IDirectXFile_CreateEnumObject: %x\n", hr);
+
+    hr = IDirectXFileEnumObject_GetNextDataObject(lpdxfeo, &lpdxfd);
+    ok(hr == DXFILE_OK, "IDirectXFileEnumObject_GetNextDataObject: %x\n", hr);
+
+    hr = IDirectXFileData_GetData(lpdxfd, NULL, &size, (void**)&pdata);
+    ok(hr == DXFILE_OK, "IDirectXFileData_GetData: %x\n", hr);
+
+    ok(size == 8, "Retreived data size is wrong\n");
+    ok((*((WORD*)pdata) == 1) && (*((WORD*)(pdata+2)) == 2) && (*((DWORD*)(pdata+4)) == 3), "Retreived data is wrong\n");
+
+    ref = IDirectXFileEnumObject_Release(lpdxfeo);
+    ok(ref == 0, "Got refcount %d, expected 0\n", ref);
+
+    ref = IDirectXFile_Release(lpDirectXFile);
+    ok(ref == 0, "Got refcount %d, expected 0\n", ref);
+
+    ref = IDirectXFileData_Release(lpdxfd);
+    ok(ref == 0, "Got refcount %d, expected 0\n", ref);
+}
+
 /* Set it to 1 to expand the string when dumping the object. This is useful when there is
  * only one string in a sub-object (very common). Use with care, this may lead to a crash. */
 #define EXPAND_STRING 0
@@ -310,6 +363,7 @@ START_TEST(d3dxof)
     init_function_pointers();
 
     test_refcount();
+    test_CreateEnumObject();
     test_dump();
 
     FreeLibrary(hd3dxof);




More information about the wine-cvs mailing list