Commit 847da79c authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

t2embed: Implement TTIsEmbeddingEnabledForFacename().

parent 33765285
MODULE = t2embed.dll MODULE = t2embed.dll
IMPORTLIB = t2embed IMPORTLIB = t2embed
IMPORTS = gdi32 IMPORTS = gdi32 advapi32
C_SRCS = \ C_SRCS = \
main.c main.c
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
#include "wingdi.h" #include "wingdi.h"
#include "winreg.h"
#include "t2embapi.h" #include "t2embapi.h"
#include "wine/debug.h" #include "wine/debug.h"
...@@ -100,6 +101,51 @@ LONG WINAPI TTGetEmbeddingType(HDC hDC, ULONG *status) ...@@ -100,6 +101,51 @@ LONG WINAPI TTGetEmbeddingType(HDC hDC, ULONG *status)
return E_NONE; return E_NONE;
} }
LONG WINAPI TTIsEmbeddingEnabledForFacename(LPCSTR facename, BOOL *enabled)
{
static const WCHAR exclusionlistW[] = {'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\',
'S','h','a','r','e','d',' ','T','o','o','l','s','\\','t','2','e','m','b','e','d',0};
DWORD index;
HKEY hkey;
LONG ret;
TRACE("(%s %p)\n", debugstr_a(facename), enabled);
if (!facename)
return E_FACENAMEINVALID;
if (!enabled)
return E_PBENABLEDINVALID;
*enabled = TRUE;
if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, exclusionlistW, 0, GENERIC_READ, &hkey))
return E_NONE;
*enabled = TRUE;
ret = ERROR_SUCCESS;
index = 0;
while (ret != ERROR_NO_MORE_ITEMS)
{
DWORD name_len, value_len, value, type;
CHAR name[LF_FACESIZE];
name_len = sizeof(name)/sizeof(*name);
value_len = sizeof(value);
ret = RegEnumValueA(hkey, index++, name, &name_len, NULL, &type, (BYTE*)&value, &value_len);
if (ret || type != REG_DWORD)
continue;
if (!lstrcmpiA(name, facename))
{
*enabled = !!value;
break;
}
}
RegCloseKey(hkey);
return E_NONE;
}
LONG WINAPI TTIsEmbeddingEnabled(HDC hDC, BOOL *enabled) LONG WINAPI TTIsEmbeddingEnabled(HDC hDC, BOOL *enabled)
{ {
FIXME("(%p %p) stub\n", hDC, enabled); FIXME("(%p %p) stub\n", hDC, enabled);
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
@ stub TTGetEmbeddedFontInfo @ stub TTGetEmbeddedFontInfo
@ stdcall TTGetEmbeddingType(long ptr) @ stdcall TTGetEmbeddingType(long ptr)
@ stdcall TTIsEmbeddingEnabled(long ptr) @ stdcall TTIsEmbeddingEnabled(long ptr)
@ stub TTIsEmbeddingEnabledForFacename @ stdcall TTIsEmbeddingEnabledForFacename(str ptr)
@ stdcall TTLoadEmbeddedFont(ptr long ptr long ptr ptr ptr wstr str ptr) @ stdcall TTLoadEmbeddedFont(ptr long ptr long ptr ptr ptr wstr str ptr)
@ stub TTRunValidationTests @ stub TTRunValidationTests
@ stub _TTCharToUnicode@24 @ stub _TTCharToUnicode@24
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
@ stub _TTGetEmbeddedFontInfo@28 @ stub _TTGetEmbeddedFontInfo@28
@ stdcall _TTGetEmbeddingType@8(long ptr) TTGetEmbeddingType @ stdcall _TTGetEmbeddingType@8(long ptr) TTGetEmbeddingType
@ stdcall _TTIsEmbeddingEnabled@8(long ptr) TTIsEmbeddingEnabled @ stdcall _TTIsEmbeddingEnabled@8(long ptr) TTIsEmbeddingEnabled
@ stub _TTIsEmbeddingEnabledForFacename@8 @ stdcall _TTIsEmbeddingEnabledForFacename@8(str ptr) TTIsEmbeddingEnabledForFacename
@ stdcall _TTLoadEmbeddedFont@40(ptr long ptr long ptr ptr ptr wstr str ptr) TTLoadEmbeddedFont @ stdcall _TTLoadEmbeddedFont@40(ptr long ptr long ptr ptr ptr wstr str ptr) TTLoadEmbeddedFont
@ stub _TTRunValidationTests@8 @ stub _TTRunValidationTests@8
@ stub TTEmbedFontEx @ stub TTEmbedFontEx
......
...@@ -76,7 +76,30 @@ static void test_TTGetEmbeddingType(void) ...@@ -76,7 +76,30 @@ static void test_TTGetEmbeddingType(void)
DeleteDC(hdc); DeleteDC(hdc);
} }
static void test_TTIsEmbeddingEnabledForFacename(void)
{
BOOL status;
LONG ret;
ret = TTIsEmbeddingEnabledForFacename(NULL, NULL);
ok(ret == E_FACENAMEINVALID, "got %#x\n", ret);
status = 123;
ret = TTIsEmbeddingEnabledForFacename(NULL, &status);
ok(ret == E_FACENAMEINVALID, "got %#x\n", ret);
ok(status == 123, "got %d\n", status);
ret = TTIsEmbeddingEnabledForFacename("Arial", NULL);
ok(ret == E_PBENABLEDINVALID, "got %#x\n", ret);
status = 123;
ret = TTIsEmbeddingEnabledForFacename("Arial", &status);
ok(ret == E_NONE, "got %#x\n", ret);
ok(status != 123, "got %d\n", status);
}
START_TEST(t2embed) START_TEST(t2embed)
{ {
test_TTGetEmbeddingType(); test_TTGetEmbeddingType();
test_TTIsEmbeddingEnabledForFacename();
} }
...@@ -42,7 +42,9 @@ extern "C" { ...@@ -42,7 +42,9 @@ extern "C" {
#define E_HDCINVALID __MSABI_LONG(0x0006) #define E_HDCINVALID __MSABI_LONG(0x0006)
#define E_NOTATRUETYPEFONT __MSABI_LONG(0x000a) #define E_NOTATRUETYPEFONT __MSABI_LONG(0x000a)
#define E_ERRORACCESSINGFONTDATA __MSABI_LONG(0x000c) #define E_ERRORACCESSINGFONTDATA __MSABI_LONG(0x000c)
#define E_FACENAMEINVALID __MSABI_LONG(0x0113)
#define E_PERMISSIONSINVALID __MSABI_LONG(0x0117) #define E_PERMISSIONSINVALID __MSABI_LONG(0x0117)
#define E_PBENABLEDINVALID __MSABI_LONG(0x0118)
typedef ULONG (WINAPIV * READEMBEDPROC)(void*,void*,ULONG); typedef ULONG (WINAPIV * READEMBEDPROC)(void*,void*,ULONG);
typedef ULONG (WINAPIV * WRITEEMBEDPROC)(void*,void*,ULONG); typedef ULONG (WINAPIV * WRITEEMBEDPROC)(void*,void*,ULONG);
...@@ -72,6 +74,7 @@ LONG WINAPI TTDeleteEmbeddedFont(HANDLE,ULONG,ULONG*); ...@@ -72,6 +74,7 @@ LONG WINAPI TTDeleteEmbeddedFont(HANDLE,ULONG,ULONG*);
#define EMBED_NOEMBEDDING 4 #define EMBED_NOEMBEDDING 4
LONG WINAPI TTGetEmbeddingType(HDC, ULONG*); LONG WINAPI TTGetEmbeddingType(HDC, ULONG*);
LONG WINAPI TTIsEmbeddingEnabledForFacename(LPCSTR facename, BOOL *enabled);
#ifdef __cplusplus #ifdef __cplusplus
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment