Exemplo n.º 1
0
Arquivo: text.c Projeto: RPG-7/reactos
/*
 * @implemented
 */
LPWSTR
WINAPI
CharLowerW(LPWSTR x)
{
    if (HIWORD(x)) return strlwrW(x);
    else return (LPWSTR)((UINT_PTR)tolowerW(LOWORD(x)));
}
Exemplo n.º 2
0
static HRESULT String_toLowerCase(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
                                  jsval_t *r)
{
    jsstr_t *str;
    HRESULT  hres;

    TRACE("\n");

    hres = get_string_val(ctx, jsthis, &str);
    if(FAILED(hres))
        return hres;

    if(r) {
        jsstr_t *ret;
        WCHAR *buf;

        buf = jsstr_alloc_buf(jsstr_length(str), &ret);
        if(!buf) {
            jsstr_release(str);
            return E_OUTOFMEMORY;
        }

        jsstr_flush(str, buf);
        strlwrW(buf);
        *r = jsval_string(ret);
    }
    jsstr_release(str);
    return S_OK;
}
Exemplo n.º 3
0
static void get_manifest_filename( const xmlstr_t *arch, const xmlstr_t *name, const xmlstr_t *key,
                                   const xmlstr_t *version, const xmlstr_t *lang, WCHAR *buffer, DWORD size )
{
    static const WCHAR trailerW[] = {'_','d','e','a','d','b','e','e','f',0};
    DWORD pos;

    pos = MultiByteToWideChar( CP_UTF8, 0, arch->ptr, arch->len, buffer, size );
    buffer[pos++] = '_';
    pos += MultiByteToWideChar( CP_UTF8, 0, name->ptr, name->len, buffer + pos, size - pos );
    buffer[pos++] = '_';
    pos += MultiByteToWideChar( CP_UTF8, 0, key->ptr, key->len, buffer + pos, size - pos );
    buffer[pos++] = '_';
    pos += MultiByteToWideChar( CP_UTF8, 0, version->ptr, version->len, buffer + pos, size - pos );
    buffer[pos++] = '_';
    pos += MultiByteToWideChar( CP_UTF8, 0, lang->ptr, lang->len, buffer + pos, size - pos );
    memcpy( buffer + pos, trailerW, sizeof(trailerW) );
    strlwrW( buffer );
}
Exemplo n.º 4
0
/***********************************************************************
 *           MSACM_WriteCurrentPriorities()
 * Writes out current order of driver priorities to registry key:
 * HKCU\\Software\\Microsoft\\Multimedia\\Audio Compression Manager\\Priority v4.00
 */
void MSACM_WriteCurrentPriorities(void)
{
    LONG lError;
    HKEY hPriorityKey;
    static const WCHAR basePriorityKey[] = {
        'S','o','f','t','w','a','r','e','\\',
        'M','i','c','r','o','s','o','f','t','\\',
        'M','u','l','t','i','m','e','d','i','a','\\',
        'A','u','d','i','o',' ','C','o','m','p','r','e','s','s','i','o','n',' ','M','a','n','a','g','e','r','\\',
        'P','r','i','o','r','i','t','y',' ','v','4','.','0','0','\0'
    };
    PWINE_ACMDRIVERID padid;
    DWORD dwPriorityCounter;
    static const WCHAR priorityTmpl[] = {'P','r','i','o','r','i','t','y','%','l','d','\0'};
    static const WCHAR valueTmpl[] = {'%','c',',',' ','%','s','\0'};
    static const WCHAR converterAlias[] = {'I','n','t','e','r','n','a','l',' ','P','C','M',' ','C','o','n','v','e','r','t','e','r','\0'};
    WCHAR szSubKey[17];
    WCHAR szBuffer[256];

    /* Delete ACM priority key and create it anew */
    lError = RegDeleteKeyW(HKEY_CURRENT_USER, basePriorityKey);
    if (lError != ERROR_SUCCESS && lError != ERROR_FILE_NOT_FOUND) {
        ERR("unable to remove current key %s (0x%08x) - priority changes won't persist past application end.\n",
            debugstr_w(basePriorityKey), lError);
        return;
    }
    lError = RegCreateKeyW(HKEY_CURRENT_USER, basePriorityKey, &hPriorityKey);
    if (lError != ERROR_SUCCESS) {
        ERR("unable to create key %s (0x%08x) - priority changes won't persist past application end.\n",
            debugstr_w(basePriorityKey), lError);
        return;
    }
    
    /* Write current list of priorities */
    for (dwPriorityCounter = 0, padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) {        
        if (padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_LOCAL) continue;
        if (padid->pszDriverAlias == NULL) continue;    /* internal PCM converter is last */

        /* Build required value name */
        dwPriorityCounter++;
        snprintfW(szSubKey, 17, priorityTmpl, dwPriorityCounter);
        
        /* Value has a 1 in front for enabled drivers and 0 for disabled drivers */
        snprintfW(szBuffer, 256, valueTmpl, (padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) ? '0' : '1', padid->pszDriverAlias);
        strlwrW(szBuffer);
        
        lError = RegSetValueExW(hPriorityKey, szSubKey, 0, REG_SZ, (BYTE *)szBuffer, (strlenW(szBuffer) + 1) * sizeof(WCHAR));
        if (lError != ERROR_SUCCESS) {
            ERR("unable to write value for %s under key %s (0x%08x)\n",
                debugstr_w(padid->pszDriverAlias), debugstr_w(basePriorityKey), lError);
        }
    }
    
    /* Build required value name */
    dwPriorityCounter++;
    snprintfW(szSubKey, 17, priorityTmpl, dwPriorityCounter);
        
    /* Value has a 1 in front for enabled drivers and 0 for disabled drivers */
    snprintfW(szBuffer, 256, valueTmpl, '1', converterAlias);
        
    lError = RegSetValueExW(hPriorityKey, szSubKey, 0, REG_SZ, (BYTE *)szBuffer, (strlenW(szBuffer) + 1) * sizeof(WCHAR));
    if (lError != ERROR_SUCCESS) {
        ERR("unable to write value for %s under key %s (0x%08x)\n",
            debugstr_w(converterAlias), debugstr_w(basePriorityKey), lError);
    }
    RegCloseKey(hPriorityKey);
}
Exemplo n.º 5
0
/*********************************************************************
 *           _wcslwr    (NTDLL.@)
 */
LPWSTR __cdecl NTDLL__wcslwr( LPWSTR str )
{
    return strlwrW( str );
}
Exemplo n.º 6
0
/* load a VxD and return a file handle to it */
HANDLE VXD_Open( LPCWSTR filenameW, DWORD access, SECURITY_ATTRIBUTES *sa )
{
    static const WCHAR dotVxDW[] = {'.','v','x','d',0};
    int i;
    HANDLE handle;
    HMODULE module;
    WCHAR *p, name[16];

    if (!(GetVersion() & 0x80000000))  /* there are no VxDs on NT */
    {
        SetLastError( ERROR_FILE_NOT_FOUND );
        return 0;
    }

    /* normalize the filename */

    if (strlenW( filenameW ) >= sizeof(name)/sizeof(WCHAR) - 4 ||
        strchrW( filenameW, '/' ) || strchrW( filenameW, '\\' ))
    {
        SetLastError( ERROR_FILE_NOT_FOUND );
        return 0;
    }
    strcpyW( name, filenameW );
    strlwrW( name );
    p = strchrW( name, '.' );
    if (!p) strcatW( name, dotVxDW );
    else if (strcmpiW( p, dotVxDW ))  /* existing extension has to be .vxd */
    {
        SetLastError( ERROR_FILE_NOT_FOUND );
        return 0;
    }

    /* try to load the module first */

    if (!(module = LoadLibraryW( name )))
    {
        FIXME( "Unknown/unsupported VxD %s. Try setting Windows version to 'nt40' or 'win31'.\n",
               debugstr_w(name) );
        SetLastError( ERROR_FILE_NOT_FOUND );
        return 0;
    }

    /* register the module in the global list if necessary */

    RtlEnterCriticalSection( &vxd_section );

    for (i = 0; i < MAX_VXD_MODULES; i++)
    {
        if (vxd_modules[i].module == module)
        {
            handle = vxd_modules[i].handle;
            goto done;  /* already registered */
        }
        if (!vxd_modules[i].module)  /* new one, register it */
        {
            IO_STATUS_BLOCK io;
            FILE_INTERNAL_INFORMATION info;

            /* get a file handle to the dummy file */
            if (!(handle = open_vxd_handle( name )))
            {
                FreeLibrary( module );
                goto done;
            }
            if (!NtQueryInformationFile( handle, &io, &info, sizeof(info), FileInternalInformation ))
                vxd_modules[i].index = info.IndexNumber;

            vxd_modules[i].module = module;
            vxd_modules[i].handle = handle;
            vxd_modules[i].proc = (DeviceIoProc)GetProcAddress( module, "DeviceIoControl" );
            goto done;
        }
    }

    ERR("too many open VxD modules, please report\n" );
    FreeLibrary( module );
    handle = 0;

done:
    RtlLeaveCriticalSection( &vxd_section );
    if (!DuplicateHandle( GetCurrentProcess(), handle, GetCurrentProcess(), &handle, 0,
                          (sa && (sa->nLength>=sizeof(*sa)) && sa->bInheritHandle),
                          DUP_HANDLE_SAME_ACCESS ))
        handle = 0;
    return handle;
}