Commit 4fab9ff2 authored by Mohamad Al-Jaf's avatar Mohamad Al-Jaf Committed by Alexandre Julliard

cfgmgr32: Implement CM_MapCrToWin32Err.

parent a98d9dd9
MODULE = cfgmgr32.dll
IMPORTLIB = cfgmgr32
IMPORTS = setupapi
C_SRCS = \
main.c
......@@ -126,6 +126,7 @@
@ stdcall CM_Locate_DevNodeW(ptr wstr long) setupapi.CM_Locate_DevNodeW
@ stdcall CM_Locate_DevNode_ExA(ptr str long long) setupapi.CM_Locate_DevNode_ExA
@ stdcall CM_Locate_DevNode_ExW(ptr wstr long long) setupapi.CM_Locate_DevNode_ExW
@ stdcall CM_MapCrToWin32Err(long long)
@ stub CM_Merge_Range_List
@ stub CM_Modify_Res_Des
@ stub CM_Modify_Res_Des_Ex
......
/*
* Copyright (C) 2023 Mohamad Al-Jaf
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "wine/debug.h"
#include "cfgmgr32.h"
WINE_DEFAULT_DEBUG_CHANNEL(setupapi);
/***********************************************************************
* CM_MapCrToWin32Err (cfgmgr32.@)
*/
DWORD WINAPI CM_MapCrToWin32Err( CONFIGRET code, DWORD default_error )
{
TRACE( "code: %#lx, default_error: %ld\n", code, default_error );
switch (code)
{
case CR_SUCCESS: return ERROR_SUCCESS;
case CR_OUT_OF_MEMORY: return ERROR_NOT_ENOUGH_MEMORY;
case CR_INVALID_POINTER: return ERROR_INVALID_USER_BUFFER;
case CR_INVALID_FLAG: return ERROR_INVALID_FLAGS;
case CR_INVALID_DEVNODE:
case CR_INVALID_DEVICE_ID:
case CR_INVALID_MACHINENAME:
case CR_INVALID_PROPERTY:
case CR_INVALID_REFERENCE_STRING: return ERROR_INVALID_DATA;
case CR_NO_SUCH_DEVNODE:
case CR_NO_SUCH_VALUE:
case CR_NO_SUCH_DEVICE_INTERFACE: return ERROR_NOT_FOUND;
case CR_ALREADY_SUCH_DEVNODE: return ERROR_ALREADY_EXISTS;
case CR_BUFFER_SMALL: return ERROR_INSUFFICIENT_BUFFER;
case CR_NO_REGISTRY_HANDLE: return ERROR_INVALID_HANDLE;
case CR_REGISTRY_ERROR: return ERROR_REGISTRY_CORRUPT;
case CR_NO_SUCH_REGISTRY_KEY: return ERROR_FILE_NOT_FOUND;
case CR_REMOTE_COMM_FAILURE:
case CR_MACHINE_UNAVAILABLE:
case CR_NO_CM_SERVICES: return ERROR_SERVICE_NOT_ACTIVE;
case CR_ACCESS_DENIED: return ERROR_ACCESS_DENIED;
case CR_CALL_NOT_IMPLEMENTED: return ERROR_CALL_NOT_IMPLEMENTED;
}
return default_error;
}
......@@ -242,6 +242,7 @@ CMAPI WORD WINAPI CM_Get_Version(void);
CMAPI CONFIGRET WINAPI CM_Locate_DevNodeA(PDEVINST,DEVINSTID_A,ULONG);
CMAPI CONFIGRET WINAPI CM_Locate_DevNodeW(PDEVINST,DEVINSTID_W,ULONG);
#define CM_Locate_DevNode WINELIB_NAME_AW(CM_Locate_DevNode)
CMAPI DWORD WINAPI CM_MapCrToWin32Err(CONFIGRET,DWORD);
CMAPI CONFIGRET WINAPI CM_Open_DevNode_Key(DEVINST dnDevInst, REGSAM access, ULONG ulHardwareProfile,
REGDISPOSITION disposition, PHKEY phkDevice, ULONG ulFlags);
CMAPI CONFIGRET WINAPI CM_Request_Device_EjectA(DEVINST dev, PPNP_VETO_TYPE type, LPSTR name, ULONG length, ULONG flags);
......
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