[PATCH 1/2] mountmgr: Make parse_uuid visible
Detlef Riekenberg
wine.dev at web.de
Thu Jun 30 07:28:20 CDT 2011
Avoid code duplication in udisks.c
---
dlls/mountmgr.sys/device.c | 28 ++++++++++++++++++++++++++++
dlls/mountmgr.sys/hal.c | 27 ---------------------------
dlls/mountmgr.sys/mountmgr.h | 1 +
3 files changed, 29 insertions(+), 27 deletions(-)
diff --git a/dlls/mountmgr.sys/device.c b/dlls/mountmgr.sys/device.c
index 8b91be6..763132a 100644
--- a/dlls/mountmgr.sys/device.c
+++ b/dlls/mountmgr.sys/device.c
@@ -121,6 +121,34 @@ static char *strdupA( const char *str )
return ret;
}
+GUID *parse_uuid( GUID *guid, const char *str )
+{
+ /* standard uuid format */
+ if (strlen(str) == 36)
+ {
+ UNICODE_STRING strW;
+ WCHAR buffer[39];
+
+ if (MultiByteToWideChar( CP_UNIXCP, 0, str, 36, buffer + 1, 36 ))
+ {
+ buffer[0] = '{';
+ buffer[37] = '}';
+ buffer[38] = 0;
+ RtlInitUnicodeString( &strW, buffer );
+ if (!RtlGUIDFromString( &strW, guid )) return guid;
+ }
+ }
+
+ /* check for xxxx-xxxx format (FAT serial number) */
+ if (strlen(str) == 9 && str[4] == '-')
+ {
+ memset( guid, 0, sizeof(*guid) );
+ if (sscanf( str, "%hx-%hx", &guid->Data2, &guid->Data3 ) == 2) return guid;
+ }
+
+ return NULL;
+}
+
static const GUID *get_default_uuid( int letter )
{
static GUID guid;
diff --git a/dlls/mountmgr.sys/hal.c b/dlls/mountmgr.sys/hal.c
index 82a70e9..ff10a3e 100644
--- a/dlls/mountmgr.sys/hal.c
+++ b/dlls/mountmgr.sys/hal.c
@@ -106,33 +106,6 @@ static LONG WINAPI assert_fault(EXCEPTION_POINTERS *eptr)
return EXCEPTION_CONTINUE_SEARCH;
}
-static GUID *parse_uuid( GUID *guid, const char *str )
-{
- /* standard uuid format */
- if (strlen(str) == 36)
- {
- UNICODE_STRING strW;
- WCHAR buffer[39];
-
- if (MultiByteToWideChar( CP_UNIXCP, 0, str, 36, buffer + 1, 36 ))
- {
- buffer[0] = '{';
- buffer[37] = '}';
- buffer[38] = 0;
- RtlInitUnicodeString( &strW, buffer );
- if (!RtlGUIDFromString( &strW, guid )) return guid;
- }
- }
-
- /* check for xxxx-xxxx format (FAT serial number) */
- if (strlen(str) == 9 && str[4] == '-')
- {
- memset( guid, 0, sizeof(*guid) );
- if (sscanf( str, "%hx-%hx", &guid->Data2, &guid->Data3 ) == 2) return guid;
- }
- return NULL;
-}
-
/* HAL callback for new device */
static void new_device( LibHalContext *ctx, const char *udi )
{
diff --git a/dlls/mountmgr.sys/mountmgr.h b/dlls/mountmgr.sys/mountmgr.h
index a47a3e3..a8e4389 100644
--- a/dlls/mountmgr.sys/mountmgr.h
+++ b/dlls/mountmgr.sys/mountmgr.h
@@ -52,6 +52,7 @@ enum device_type
DEVICE_RAMDISK
};
+extern GUID *parse_uuid( GUID *guid, const char *str ) DECLSPEC_HIDDEN;
extern NTSTATUS add_volume( const char *udi, const char *device, const char *mount_point,
enum device_type type, const GUID *guid ) DECLSPEC_HIDDEN;
extern NTSTATUS remove_volume( const char *udi ) DECLSPEC_HIDDEN;
--
1.7.5.4
More information about the wine-patches
mailing list