"Stefan Leichter" <Stefan.Leichter(a)camline.com> wrote:
i like to know what modifikations the attached patch needs to go into git.
1. patch needs to be created with git 2. there is no need to create a new file
@@ -175,6 +180,16 @@ p_libhal_device_add_property_watch( ctx, udi, &error ); } else if (guid_ptr) add_volume( udi, device, mount_point, DEVICE_HARDDISK_VOL, guid_ptr ); + goto done;
Is there any reason you are doing 'goto done' above?
+ +serial: + if (!(device = p_libhal_device_get_property_string( ctx, udi, "serial.device", &error ))) + goto done; + + if ( -1 == (port = p_libhal_device_get_property_int( ctx, udi, "serial.port", &error ))) + goto done;
'if ( -1 == port...' doesn't match existing style, 'if (port... == -1)' does. Same for other places.
+ + add_serial_device(port, device);
done: if (type) p_libhal_free_string( type );
+NTSTATUS add_serial_device(int port, const char *device) +{ + static const WCHAR format_data[] = {'C','O','M','%','d',0}; + static const WCHAR serialcom[] = {'M','a','c','h','i','n','e','\\', + 'H','A','R','D','W','A','R','E','\\', + 'D','E','V','I','C','E','M','A','P','\\', + 'S','E','R','I','A','L','C','O','M','M',0}; + static const UNICODE_STRING serialcom_str + = {sizeof(serialcom)-1, sizeof(serialcom), (WCHAR*) serialcom};
You should not cast away 'const'.
+ + CHAR value[50]; + HANDLE targetKey = NULL; + NTSTATUS retval; + OBJECT_ATTRIBUTES attr; + UNICODE_STRING valueU = {0, 0, NULL};
Initialization is not needed above since you are doing it anyway.
+ WCHAR data[10]; + + attr.Length = sizeof(attr); + attr.RootDirectory = 0; + attr.ObjectName = (UNICODE_STRING*) &serialcom_str;
You should not cast away 'const'. -- Dmitry.