> + }
> +
> + return 0;
> +}
> +
> +static map_drive_enum
> +map_drive(void)
> +{
> + gchar local_name[3];
> + gchar remote_name[] = "http://localhost:9843/";
P: it is only used in the net_resource
L: Ok will change
> + NETRESOURCE net_resource;
> + guint32 retval;
> +
> + local_name[0] = drive_letter;
P: drive_letter should be parameter to this function
L: See previous comment
> + local_name[1] = ':';
> + local_name[2] = 0;
I would prefer some sprintf-like function instead
Ok will change
> +
> + net_resource.dwType = RESOURCETYPE_DISK;
> + net_resource.lpLocalName = local_name;
> + net_resource.lpRemoteName = remote_name;
> + net_resource.lpProvider = NULL;
P:In my opinion setting up net_resource should go to a separate
function,. You don't need 'local_name' and 'remote_name' to map the
drive, you need the net_resource.
L: Ok will change
> +
> + retval = WNetAddConnection2 (&net_resource, NULL, NULL,
> CONNECT_TEMPORARY);
> +
> + if (retval == NO_ERROR) {
> + g_debug ("map_drive ok");
> + return MAP_DRIVE_OK;
> + } else if (retval == ERROR_ALREADY_ASSIGNED) {
> + g_debug ("map_drive already asigned");
> + return MAP_DRIVE_TRY_AGAIN;
> + } else {
> + g_critical ("map_drive error %d", retval);
P: Is it critical enough to exit the program? I would use g_warning
L: g_critical doesnt exit the program, but no other error then ALREADY_ASIGNED should happen here