diff options
| author | Stefan Monnier | 2011-03-31 00:24:03 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2011-03-31 00:24:03 -0400 |
| commit | 40d83b412f584cc02e68d4eac8fd5e6eb769e2fe (patch) | |
| tree | b56f27a7e6d75a8c1fd27b00179a27b5efea0a32 /src/w32.c | |
| parent | f488fb6528738131ef41859e1f04125f2e50efce (diff) | |
| parent | 44f230aa043ebb222aa0876b44d70484d5dd38db (diff) | |
| download | emacs-40d83b412f584cc02e68d4eac8fd5e6eb769e2fe.tar.gz emacs-40d83b412f584cc02e68d4eac8fd5e6eb769e2fe.zip | |
Merge from trunk
Diffstat (limited to 'src/w32.c')
| -rw-r--r-- | src/w32.c | 245 |
1 files changed, 121 insertions, 124 deletions
| @@ -1505,6 +1505,7 @@ w32_get_resource (char *key, LPDWORD lpdwtype) | |||
| 1505 | } | 1505 | } |
| 1506 | 1506 | ||
| 1507 | char *get_emacs_configuration (void); | 1507 | char *get_emacs_configuration (void); |
| 1508 | |||
| 1508 | void | 1509 | void |
| 1509 | init_environment (char ** argv) | 1510 | init_environment (char ** argv) |
| 1510 | { | 1511 | { |
| @@ -1591,25 +1592,25 @@ init_environment (char ** argv) | |||
| 1591 | If not, then we can try to default to the appdata directory under the | 1592 | If not, then we can try to default to the appdata directory under the |
| 1592 | user's profile, which is more likely to be writable. */ | 1593 | user's profile, which is more likely to be writable. */ |
| 1593 | if (stat ("C:/.emacs", &ignored) < 0) | 1594 | if (stat ("C:/.emacs", &ignored) < 0) |
| 1594 | { | 1595 | { |
| 1595 | HRESULT profile_result; | 1596 | HRESULT profile_result; |
| 1596 | /* Dynamically load ShGetFolderPath, as it won't exist on versions | 1597 | /* Dynamically load ShGetFolderPath, as it won't exist on versions |
| 1597 | of Windows 95 and NT4 that have not been updated to include | 1598 | of Windows 95 and NT4 that have not been updated to include |
| 1598 | MSIE 5. */ | 1599 | MSIE 5. */ |
| 1599 | ShGetFolderPath_fn get_folder_path; | 1600 | ShGetFolderPath_fn get_folder_path; |
| 1600 | get_folder_path = (ShGetFolderPath_fn) | 1601 | get_folder_path = (ShGetFolderPath_fn) |
| 1601 | GetProcAddress (GetModuleHandle ("shell32.dll"), "SHGetFolderPathA"); | 1602 | GetProcAddress (GetModuleHandle ("shell32.dll"), "SHGetFolderPathA"); |
| 1602 | 1603 | ||
| 1603 | if (get_folder_path != NULL) | 1604 | if (get_folder_path != NULL) |
| 1604 | { | 1605 | { |
| 1605 | profile_result = get_folder_path (NULL, CSIDL_APPDATA, NULL, | 1606 | profile_result = get_folder_path (NULL, CSIDL_APPDATA, NULL, |
| 1606 | 0, default_home); | 1607 | 0, default_home); |
| 1607 | 1608 | ||
| 1608 | /* If we can't get the appdata dir, revert to old behavior. */ | 1609 | /* If we can't get the appdata dir, revert to old behavior. */ |
| 1609 | if (profile_result == S_OK) | 1610 | if (profile_result == S_OK) |
| 1610 | env_vars[0].def_value = default_home; | 1611 | env_vars[0].def_value = default_home; |
| 1611 | } | 1612 | } |
| 1612 | } | 1613 | } |
| 1613 | 1614 | ||
| 1614 | /* Get default locale info and use it for LANG. */ | 1615 | /* Get default locale info and use it for LANG. */ |
| 1615 | if (GetLocaleInfo (LOCALE_USER_DEFAULT, | 1616 | if (GetLocaleInfo (LOCALE_USER_DEFAULT, |
| @@ -2082,42 +2083,42 @@ GetCachedVolumeInformation (char * root_dir) | |||
| 2082 | info = lookup_volume_info (root_dir); | 2083 | info = lookup_volume_info (root_dir); |
| 2083 | 2084 | ||
| 2084 | if (info == NULL || ! VOLINFO_STILL_VALID (root_dir, info)) | 2085 | if (info == NULL || ! VOLINFO_STILL_VALID (root_dir, info)) |
| 2085 | { | 2086 | { |
| 2086 | char name[ 256 ]; | 2087 | char name[ 256 ]; |
| 2087 | DWORD serialnum; | 2088 | DWORD serialnum; |
| 2088 | DWORD maxcomp; | 2089 | DWORD maxcomp; |
| 2089 | DWORD flags; | 2090 | DWORD flags; |
| 2090 | char type[ 256 ]; | 2091 | char type[ 256 ]; |
| 2091 | 2092 | ||
| 2092 | /* Info is not cached, or is stale. */ | 2093 | /* Info is not cached, or is stale. */ |
| 2093 | if (!GetVolumeInformation (root_dir, | 2094 | if (!GetVolumeInformation (root_dir, |
| 2094 | name, sizeof (name), | 2095 | name, sizeof (name), |
| 2095 | &serialnum, | 2096 | &serialnum, |
| 2096 | &maxcomp, | 2097 | &maxcomp, |
| 2097 | &flags, | 2098 | &flags, |
| 2098 | type, sizeof (type))) | 2099 | type, sizeof (type))) |
| 2099 | return NULL; | 2100 | return NULL; |
| 2100 | 2101 | ||
| 2101 | /* Cache the volume information for future use, overwriting existing | 2102 | /* Cache the volume information for future use, overwriting existing |
| 2102 | entry if present. */ | 2103 | entry if present. */ |
| 2103 | if (info == NULL) | 2104 | if (info == NULL) |
| 2104 | { | 2105 | { |
| 2105 | info = (volume_info_data *) xmalloc (sizeof (volume_info_data)); | 2106 | info = (volume_info_data *) xmalloc (sizeof (volume_info_data)); |
| 2106 | add_volume_info (root_dir, info); | 2107 | add_volume_info (root_dir, info); |
| 2107 | } | 2108 | } |
| 2108 | else | 2109 | else |
| 2109 | { | 2110 | { |
| 2110 | xfree (info->name); | 2111 | xfree (info->name); |
| 2111 | xfree (info->type); | 2112 | xfree (info->type); |
| 2112 | } | 2113 | } |
| 2113 | 2114 | ||
| 2114 | info->name = xstrdup (name); | 2115 | info->name = xstrdup (name); |
| 2115 | info->serialnum = serialnum; | 2116 | info->serialnum = serialnum; |
| 2116 | info->maxcomp = maxcomp; | 2117 | info->maxcomp = maxcomp; |
| 2117 | info->flags = flags; | 2118 | info->flags = flags; |
| 2118 | info->type = xstrdup (type); | 2119 | info->type = xstrdup (type); |
| 2119 | info->timestamp = GetTickCount (); | 2120 | info->timestamp = GetTickCount (); |
| 2120 | } | 2121 | } |
| 2121 | 2122 | ||
| 2122 | return info; | 2123 | return info; |
| 2123 | } | 2124 | } |
| @@ -2376,8 +2377,8 @@ readdir (DIR *dirp) | |||
| 2376 | if (wnet_enum_handle != INVALID_HANDLE_VALUE) | 2377 | if (wnet_enum_handle != INVALID_HANDLE_VALUE) |
| 2377 | { | 2378 | { |
| 2378 | if (!read_unc_volume (wnet_enum_handle, | 2379 | if (!read_unc_volume (wnet_enum_handle, |
| 2379 | dir_find_data.cFileName, | 2380 | dir_find_data.cFileName, |
| 2380 | MAX_PATH)) | 2381 | MAX_PATH)) |
| 2381 | return NULL; | 2382 | return NULL; |
| 2382 | } | 2383 | } |
| 2383 | /* If we aren't dir_finding, do a find-first, otherwise do a find-next. */ | 2384 | /* If we aren't dir_finding, do a find-first, otherwise do a find-next. */ |
| @@ -2487,7 +2488,7 @@ read_unc_volume (HANDLE henum, char *readbuf, int size) | |||
| 2487 | 2488 | ||
| 2488 | count = 1; | 2489 | count = 1; |
| 2489 | buffer = alloca (bufsize); | 2490 | buffer = alloca (bufsize); |
| 2490 | result = WNetEnumResource (wnet_enum_handle, &count, buffer, &bufsize); | 2491 | result = WNetEnumResource (henum, &count, buffer, &bufsize); |
| 2491 | if (result != NO_ERROR) | 2492 | if (result != NO_ERROR) |
| 2492 | return NULL; | 2493 | return NULL; |
| 2493 | 2494 | ||
| @@ -3250,8 +3251,6 @@ int | |||
| 3250 | stat (const char * path, struct stat * buf) | 3251 | stat (const char * path, struct stat * buf) |
| 3251 | { | 3252 | { |
| 3252 | char *name, *r; | 3253 | char *name, *r; |
| 3253 | char drive_root[4]; | ||
| 3254 | UINT devtype; | ||
| 3255 | WIN32_FIND_DATA wfd; | 3254 | WIN32_FIND_DATA wfd; |
| 3256 | HANDLE fh; | 3255 | HANDLE fh; |
| 3257 | unsigned __int64 fake_inode; | 3256 | unsigned __int64 fake_inode; |
| @@ -4043,7 +4042,6 @@ system_process_attributes (Lisp_Object pid) | |||
| 4043 | TOKEN_PRIMARY_GROUP group_token; | 4042 | TOKEN_PRIMARY_GROUP group_token; |
| 4044 | unsigned euid; | 4043 | unsigned euid; |
| 4045 | unsigned egid; | 4044 | unsigned egid; |
| 4046 | DWORD sess; | ||
| 4047 | PROCESS_MEMORY_COUNTERS mem; | 4045 | PROCESS_MEMORY_COUNTERS mem; |
| 4048 | PROCESS_MEMORY_COUNTERS_EX mem_ex; | 4046 | PROCESS_MEMORY_COUNTERS_EX mem_ex; |
| 4049 | DWORD minrss, maxrss; | 4047 | DWORD minrss, maxrss; |
| @@ -4520,75 +4518,75 @@ struct { | |||
| 4520 | int errnum; | 4518 | int errnum; |
| 4521 | char * msg; | 4519 | char * msg; |
| 4522 | } _wsa_errlist[] = { | 4520 | } _wsa_errlist[] = { |
| 4523 | WSAEINTR , "Interrupted function call", | 4521 | {WSAEINTR , "Interrupted function call"}, |
| 4524 | WSAEBADF , "Bad file descriptor", | 4522 | {WSAEBADF , "Bad file descriptor"}, |
| 4525 | WSAEACCES , "Permission denied", | 4523 | {WSAEACCES , "Permission denied"}, |
| 4526 | WSAEFAULT , "Bad address", | 4524 | {WSAEFAULT , "Bad address"}, |
| 4527 | WSAEINVAL , "Invalid argument", | 4525 | {WSAEINVAL , "Invalid argument"}, |
| 4528 | WSAEMFILE , "Too many open files", | 4526 | {WSAEMFILE , "Too many open files"}, |
| 4529 | 4527 | ||
| 4530 | WSAEWOULDBLOCK , "Resource temporarily unavailable", | 4528 | {WSAEWOULDBLOCK , "Resource temporarily unavailable"}, |
| 4531 | WSAEINPROGRESS , "Operation now in progress", | 4529 | {WSAEINPROGRESS , "Operation now in progress"}, |
| 4532 | WSAEALREADY , "Operation already in progress", | 4530 | {WSAEALREADY , "Operation already in progress"}, |
| 4533 | WSAENOTSOCK , "Socket operation on non-socket", | 4531 | {WSAENOTSOCK , "Socket operation on non-socket"}, |
| 4534 | WSAEDESTADDRREQ , "Destination address required", | 4532 | {WSAEDESTADDRREQ , "Destination address required"}, |
| 4535 | WSAEMSGSIZE , "Message too long", | 4533 | {WSAEMSGSIZE , "Message too long"}, |
| 4536 | WSAEPROTOTYPE , "Protocol wrong type for socket", | 4534 | {WSAEPROTOTYPE , "Protocol wrong type for socket"}, |
| 4537 | WSAENOPROTOOPT , "Bad protocol option", | 4535 | {WSAENOPROTOOPT , "Bad protocol option"}, |
| 4538 | WSAEPROTONOSUPPORT , "Protocol not supported", | 4536 | {WSAEPROTONOSUPPORT , "Protocol not supported"}, |
| 4539 | WSAESOCKTNOSUPPORT , "Socket type not supported", | 4537 | {WSAESOCKTNOSUPPORT , "Socket type not supported"}, |
| 4540 | WSAEOPNOTSUPP , "Operation not supported", | 4538 | {WSAEOPNOTSUPP , "Operation not supported"}, |
| 4541 | WSAEPFNOSUPPORT , "Protocol family not supported", | 4539 | {WSAEPFNOSUPPORT , "Protocol family not supported"}, |
| 4542 | WSAEAFNOSUPPORT , "Address family not supported by protocol family", | 4540 | {WSAEAFNOSUPPORT , "Address family not supported by protocol family"}, |
| 4543 | WSAEADDRINUSE , "Address already in use", | 4541 | {WSAEADDRINUSE , "Address already in use"}, |
| 4544 | WSAEADDRNOTAVAIL , "Cannot assign requested address", | 4542 | {WSAEADDRNOTAVAIL , "Cannot assign requested address"}, |
| 4545 | WSAENETDOWN , "Network is down", | 4543 | {WSAENETDOWN , "Network is down"}, |
| 4546 | WSAENETUNREACH , "Network is unreachable", | 4544 | {WSAENETUNREACH , "Network is unreachable"}, |
| 4547 | WSAENETRESET , "Network dropped connection on reset", | 4545 | {WSAENETRESET , "Network dropped connection on reset"}, |
| 4548 | WSAECONNABORTED , "Software caused connection abort", | 4546 | {WSAECONNABORTED , "Software caused connection abort"}, |
| 4549 | WSAECONNRESET , "Connection reset by peer", | 4547 | {WSAECONNRESET , "Connection reset by peer"}, |
| 4550 | WSAENOBUFS , "No buffer space available", | 4548 | {WSAENOBUFS , "No buffer space available"}, |
| 4551 | WSAEISCONN , "Socket is already connected", | 4549 | {WSAEISCONN , "Socket is already connected"}, |
| 4552 | WSAENOTCONN , "Socket is not connected", | 4550 | {WSAENOTCONN , "Socket is not connected"}, |
| 4553 | WSAESHUTDOWN , "Cannot send after socket shutdown", | 4551 | {WSAESHUTDOWN , "Cannot send after socket shutdown"}, |
| 4554 | WSAETOOMANYREFS , "Too many references", /* not sure */ | 4552 | {WSAETOOMANYREFS , "Too many references"}, /* not sure */ |
| 4555 | WSAETIMEDOUT , "Connection timed out", | 4553 | {WSAETIMEDOUT , "Connection timed out"}, |
| 4556 | WSAECONNREFUSED , "Connection refused", | 4554 | {WSAECONNREFUSED , "Connection refused"}, |
| 4557 | WSAELOOP , "Network loop", /* not sure */ | 4555 | {WSAELOOP , "Network loop"}, /* not sure */ |
| 4558 | WSAENAMETOOLONG , "Name is too long", | 4556 | {WSAENAMETOOLONG , "Name is too long"}, |
| 4559 | WSAEHOSTDOWN , "Host is down", | 4557 | {WSAEHOSTDOWN , "Host is down"}, |
| 4560 | WSAEHOSTUNREACH , "No route to host", | 4558 | {WSAEHOSTUNREACH , "No route to host"}, |
| 4561 | WSAENOTEMPTY , "Buffer not empty", /* not sure */ | 4559 | {WSAENOTEMPTY , "Buffer not empty"}, /* not sure */ |
| 4562 | WSAEPROCLIM , "Too many processes", | 4560 | {WSAEPROCLIM , "Too many processes"}, |
| 4563 | WSAEUSERS , "Too many users", /* not sure */ | 4561 | {WSAEUSERS , "Too many users"}, /* not sure */ |
| 4564 | WSAEDQUOT , "Double quote in host name", /* really not sure */ | 4562 | {WSAEDQUOT , "Double quote in host name"}, /* really not sure */ |
| 4565 | WSAESTALE , "Data is stale", /* not sure */ | 4563 | {WSAESTALE , "Data is stale"}, /* not sure */ |
| 4566 | WSAEREMOTE , "Remote error", /* not sure */ | 4564 | {WSAEREMOTE , "Remote error"}, /* not sure */ |
| 4567 | 4565 | ||
| 4568 | WSASYSNOTREADY , "Network subsystem is unavailable", | 4566 | {WSASYSNOTREADY , "Network subsystem is unavailable"}, |
| 4569 | WSAVERNOTSUPPORTED , "WINSOCK.DLL version out of range", | 4567 | {WSAVERNOTSUPPORTED , "WINSOCK.DLL version out of range"}, |
| 4570 | WSANOTINITIALISED , "Winsock not initialized successfully", | 4568 | {WSANOTINITIALISED , "Winsock not initialized successfully"}, |
| 4571 | WSAEDISCON , "Graceful shutdown in progress", | 4569 | {WSAEDISCON , "Graceful shutdown in progress"}, |
| 4572 | #ifdef WSAENOMORE | 4570 | #ifdef WSAENOMORE |
| 4573 | WSAENOMORE , "No more operations allowed", /* not sure */ | 4571 | {WSAENOMORE , "No more operations allowed"}, /* not sure */ |
| 4574 | WSAECANCELLED , "Operation cancelled", /* not sure */ | 4572 | {WSAECANCELLED , "Operation cancelled"}, /* not sure */ |
| 4575 | WSAEINVALIDPROCTABLE , "Invalid procedure table from service provider", | 4573 | {WSAEINVALIDPROCTABLE , "Invalid procedure table from service provider"}, |
| 4576 | WSAEINVALIDPROVIDER , "Invalid service provider version number", | 4574 | {WSAEINVALIDPROVIDER , "Invalid service provider version number"}, |
| 4577 | WSAEPROVIDERFAILEDINIT , "Unable to initialize a service provider", | 4575 | {WSAEPROVIDERFAILEDINIT , "Unable to initialize a service provider"}, |
| 4578 | WSASYSCALLFAILURE , "System call failure", | 4576 | {WSASYSCALLFAILURE , "System call failure"}, |
| 4579 | WSASERVICE_NOT_FOUND , "Service not found", /* not sure */ | 4577 | {WSASERVICE_NOT_FOUND , "Service not found"}, /* not sure */ |
| 4580 | WSATYPE_NOT_FOUND , "Class type not found", | 4578 | {WSATYPE_NOT_FOUND , "Class type not found"}, |
| 4581 | WSA_E_NO_MORE , "No more resources available", /* really not sure */ | 4579 | {WSA_E_NO_MORE , "No more resources available"}, /* really not sure */ |
| 4582 | WSA_E_CANCELLED , "Operation already cancelled", /* really not sure */ | 4580 | {WSA_E_CANCELLED , "Operation already cancelled"}, /* really not sure */ |
| 4583 | WSAEREFUSED , "Operation refused", /* not sure */ | 4581 | {WSAEREFUSED , "Operation refused"}, /* not sure */ |
| 4584 | #endif | 4582 | #endif |
| 4585 | 4583 | ||
| 4586 | WSAHOST_NOT_FOUND , "Host not found", | 4584 | {WSAHOST_NOT_FOUND , "Host not found"}, |
| 4587 | WSATRY_AGAIN , "Authoritative host not found during name lookup", | 4585 | {WSATRY_AGAIN , "Authoritative host not found during name lookup"}, |
| 4588 | WSANO_RECOVERY , "Non-recoverable error during name lookup", | 4586 | {WSANO_RECOVERY , "Non-recoverable error during name lookup"}, |
| 4589 | WSANO_DATA , "Valid name, no data record of requested type", | 4587 | {WSANO_DATA , "Valid name, no data record of requested type"}, |
| 4590 | 4588 | ||
| 4591 | -1, NULL | 4589 | {-1, NULL} |
| 4592 | }; | 4590 | }; |
| 4593 | 4591 | ||
| 4594 | char * | 4592 | char * |
| @@ -5408,7 +5406,6 @@ sys_read (int fd, char * buffer, unsigned int count) | |||
| 5408 | { | 5406 | { |
| 5409 | HANDLE hnd = fd_info[fd].hnd; | 5407 | HANDLE hnd = fd_info[fd].hnd; |
| 5410 | OVERLAPPED *ovl = &fd_info[fd].cp->ovl_read; | 5408 | OVERLAPPED *ovl = &fd_info[fd].cp->ovl_read; |
| 5411 | DWORD err = 0; | ||
| 5412 | int rc = 0; | 5409 | int rc = 0; |
| 5413 | COMMTIMEOUTS ct; | 5410 | COMMTIMEOUTS ct; |
| 5414 | 5411 | ||