예제 #1
0
static bool getKnownFolderVista(const GUID& id, clc::Buffer& d)
{
    bool success = false;
    typedef HRESULT (STDAPICALLTYPE * SHGetKnownFolderPathFN)(
        const GUID & rfid,
        DWORD dwFlags,
        HANDLE hToken,
        PWSTR *ppszPath);
    HMODULE lib = LoadLibrary("Shell32.dll");
    do {
        if (! lib)
            break;
        SHGetKnownFolderPathFN SHGetKnownFolderPath = (SHGetKnownFolderPathFN)GetProcAddress(lib, "SHGetKnownFolderPath");
        if (!SHGetKnownFolderPath)
            break;
        PWSTR pwszPath;
        if ((SHGetKnownFolderPath)(id, KF_FLAG_CREATE, NULL, &pwszPath) != S_OK)
            break;
        d = Utf::convertUTF16toUTF8((uint16_t*)pwszPath, wcslen(pwszPath)*2);
        DEBUG_PRINT(("getKnownFolderVista: %s\n", d.c_str()));
        success = true;
        CoTaskMemFree(pwszPath);
    } while(0);
    if (lib)
        FreeLibrary(lib);
    return success;
}
예제 #2
0
파일: Css.cpp 프로젝트: jean/OcherBook
void CssParser::parseString(clc::Buffer &b)
{
	css_error code;
	code = css_stylesheet_append_data(sheet, (const uint8_t*)b.c_str(), b.length());
	if (code != CSS_OK && code != CSS_NEEDDATA)
		die("css_stylesheet_append_data", code);
	code = css_stylesheet_data_done(sheet);
	if (code != CSS_OK)
		die("css_stylesheet_data_done", code);
}
예제 #3
0
static bool getKnownFolder(int id, clc::Buffer& d)
{
    TCHAR szPath[MAX_PATH];
    bool success = SHGetFolderPath(NULL, id, NULL, 0, szPath) == S_OK;
    if (success) {
        d = szPath;
        DEBUG_PRINT(("getKnownFolder: %s\n", d.c_str()));
    }
    return success;
}