comparison src/nt.c @ 5000:44d7bde26046

fix compile errors, fix revert-buffer bug on binary/Latin 1 files, Mule-ize some files -------------------- ChangeLog entries follow: -------------------- src/ChangeLog addition: 2010-02-07 Ben Wing <ben@xemacs.org> * emacs.c (make_argc_argv): Cast to Wexttext * to fix compile error. * nt.c (init_user_info): Cast to CIbyte * to fix compile error. * nt.c (open_unc_volume): To fix compile error, store pathname into an Extbyte * variable then write into the dest, casting to LPTSTR. * emacs.c (debug_can_access_memory): * fileio.c (Fmake_temp_name): * fileio.c (a_write): * fns.c: * fns.c (check_losing_bytecode): * fns.c (plists_differ): * fns.c (internal_equal_trapping_problems): * fns.c (base64_value_to_char): * fns.c (base64_conversion_error): * fns.c (STORE_BYTE): * fns.c (vars_of_fns): * lisp.h: * nt.c (init_user_info): * nt.c (mswindows_readdir): * nt.c (mswindows_executable_type): Replace raw `char *' or `unsigned char *' with characterized type -- Rawbyte, Binbyte, Boolbyte, Ibyte or Ascbyte. This should fix at least one real bug -- in a_write(), the "speedy insert" code that checks for an unchanged region declared the file data read in as char[] but then compared the value to an Ichar. Hence, any chars in the range 128-255 would always appear changed -- in particular, this algorithm would fail completely with binary data.
author Ben Wing <ben@xemacs.org>
date Sun, 07 Feb 2010 05:21:40 -0600
parents 3c3c1d139863
children ecdc03ef6e12
comparison
equal deleted inserted replaced
4994:76af7fc13e81 5000:44d7bde26046
156 && GetTokenInformation (token, TokenUser, &sidinfo, sizeof (sidinfo), 156 && GetTokenInformation (token, TokenUser, &sidinfo, sizeof (sidinfo),
157 &trash) 157 &trash)
158 && qxeLookupAccountSid (NULL, sidinfo.User.Sid, name, &length, 158 && qxeLookupAccountSid (NULL, sidinfo.User.Sid, name, &length,
159 domain, &dlength, &user_type)) 159 domain, &dlength, &user_type))
160 { 160 {
161 the_passwd.pw_name = TSTR_TO_ITEXT_MALLOC (name); 161 the_passwd.pw_name = (CIbyte *) TSTR_TO_ITEXT_MALLOC (name);
162 /* Determine a reasonable uid value. */ 162 /* Determine a reasonable uid value. */
163 if (qxestrcasecmp ("administrator", the_passwd.pw_name) == 0) 163 if (qxestrcasecmp ((Ibyte *) the_passwd.pw_name, "administrator") == 0)
164 { 164 {
165 the_passwd.pw_uid = 0; 165 the_passwd.pw_uid = 0;
166 the_passwd.pw_gid = 0; 166 the_passwd.pw_gid = 0;
167 } 167 }
168 else 168 else
200 } 200 }
201 /* If security calls are not supported (presumably because we 201 /* If security calls are not supported (presumably because we
202 are running under Windows 95), fallback to this. */ 202 are running under Windows 95), fallback to this. */
203 else if (qxeGetUserName (name, &length)) 203 else if (qxeGetUserName (name, &length))
204 { 204 {
205 the_passwd.pw_name = TSTR_TO_ITEXT_MALLOC (name); 205 the_passwd.pw_name = (CIbyte *) TSTR_TO_ITEXT_MALLOC (name);
206 if (qxestrcasecmp ("administrator", the_passwd.pw_name) == 0) 206 if (qxestrcasecmp_ascii ((Ibyte *) the_passwd.pw_name,
207 "administrator") == 0)
207 the_passwd.pw_uid = 0; 208 the_passwd.pw_uid = 0;
208 else 209 else
209 the_passwd.pw_uid = 123; 210 the_passwd.pw_uid = 123;
210 the_passwd.pw_gid = the_passwd.pw_uid; 211 the_passwd.pw_gid = the_passwd.pw_uid;
211 } 212 }
221 #else 222 #else
222 /* Obtain only logon id here, uid part is moved to getuid */ 223 /* Obtain only logon id here, uid part is moved to getuid */
223 DWORD length = UNLEN + 1; 224 DWORD length = UNLEN + 1;
224 Extbyte name[MAX_XETCHAR_SIZE * (UNLEN + 1)]; 225 Extbyte name[MAX_XETCHAR_SIZE * (UNLEN + 1)];
225 if (qxeGetUserName (name, &length)) 226 if (qxeGetUserName (name, &length))
226 the_passwd.pw_name = TSTR_TO_ITEXT_MALLOC (name); 227 the_passwd.pw_name = (CIbyte *) TSTR_TO_ITEXT_MALLOC (name);
227 else 228 else
228 the_passwd.pw_name = "unknown"; 229 the_passwd.pw_name = "unknown";
229 #endif 230 #endif
230 231
231 #if 0 232 #if 0
236 if (egetenv ("HOME") == NULL) 237 if (egetenv ("HOME") == NULL)
237 eputenv ("HOME=c:/"); 238 eputenv ("HOME=c:/");
238 #endif 239 #endif
239 240
240 /* Set dir from environment variables. */ 241 /* Set dir from environment variables. */
241 the_passwd.pw_dir = (char *) qxestrdup (get_home_directory ()); 242 the_passwd.pw_dir = (CIbyte *) qxestrdup (get_home_directory ());
242 /* We used to set pw_shell here, but the order is wrong (SHELL gets 243 /* We used to set pw_shell here, but the order is wrong (SHELL gets
243 initted in process.c, called later in the init process) and pw_shell 244 initted in process.c, called later in the init process) and pw_shell
244 is not used anywhere. */ 245 is not used anywhere. */
245 } 246 }
246 247
938 939
939 if (!NILP (Vmswindows_downcase_file_names)) 940 if (!NILP (Vmswindows_downcase_file_names))
940 eilwr (found); 941 eilwr (found);
941 942
942 namlen = min (eilen (found), sizeof (dir_static.d_name) - 1); 943 namlen = min (eilen (found), sizeof (dir_static.d_name) - 1);
943 strncpy (dir_static.d_name, (char *) eidata (found), namlen); 944 qxestrncpy ((Ibyte *) dir_static.d_name, eidata (found), namlen);
944 dir_static.d_name[namlen] = '\0'; 945 dir_static.d_name[namlen] = '\0';
945 dir_static.d_namlen = (unsigned short) namlen; 946 dir_static.d_namlen = (unsigned short) namlen;
946 } 947 }
947 948
948 return &dir_static; 949 return &dir_static;
952 open_unc_volume (const Ibyte *path) 953 open_unc_volume (const Ibyte *path)
953 { 954 {
954 NETRESOURCEW nr; 955 NETRESOURCEW nr;
955 HANDLE henum; 956 HANDLE henum;
956 int result; 957 int result;
958 Extbyte *extpath;
957 959
958 nr.dwScope = RESOURCE_GLOBALNET; 960 nr.dwScope = RESOURCE_GLOBALNET;
959 nr.dwType = RESOURCETYPE_DISK; 961 nr.dwType = RESOURCETYPE_DISK;
960 nr.dwDisplayType = RESOURCEDISPLAYTYPE_SERVER; 962 nr.dwDisplayType = RESOURCEDISPLAYTYPE_SERVER;
961 nr.dwUsage = RESOURCEUSAGE_CONTAINER; 963 nr.dwUsage = RESOURCEUSAGE_CONTAINER;
962 nr.lpLocalName = NULL; 964 nr.lpLocalName = NULL;
963 PATHNAME_CONVERT_OUT (path, nr.lpRemoteName); 965 PATHNAME_CONVERT_OUT (path, extpath);
966 nr.lpRemoteName = (LPTSTR) extpath;
964 nr.lpComment = NULL; 967 nr.lpComment = NULL;
965 nr.lpProvider = NULL; 968 nr.lpProvider = NULL;
966 969
967 result = qxeWNetOpenEnum (RESOURCE_GLOBALNET, RESOURCETYPE_DISK, 970 result = qxeWNetOpenEnum (RESOURCE_GLOBALNET, RESOURCETYPE_DISK,
968 RESOURCEUSAGE_CONNECTABLE, &nr, &henum); 971 RESOURCEUSAGE_CONNECTABLE, &nr, &henum);
2000 2003
2001 exe_header = (FILHDR *) executable.file_base; 2004 exe_header = (FILHDR *) executable.file_base;
2002 if (exe_header->e_magic != DOSMAGIC) 2005 if (exe_header->e_magic != DOSMAGIC)
2003 goto unwind; 2006 goto unwind;
2004 2007
2005 if ((char *) exe_header->e_lfanew > (char *) executable.size) 2008 if ((Rawbyte *) exe_header->e_lfanew > (Rawbyte *) executable.size)
2006 { 2009 {
2007 /* Some dos headers (pkunzip) have bogus e_lfanew fields. */ 2010 /* Some dos headers (pkunzip) have bogus e_lfanew fields. */
2008 *is_dos_app = TRUE; 2011 *is_dos_app = TRUE;
2009 } 2012 }
2010 else if (exe_header->nt_signature != NT_SIGNATURE) 2013 else if (exe_header->nt_signature != NT_SIGNATURE)
2017 2020
2018 dos_header = (PIMAGE_DOS_HEADER) executable.file_base; 2021 dos_header = (PIMAGE_DOS_HEADER) executable.file_base;
2019 if (dos_header->e_magic != IMAGE_DOS_SIGNATURE) 2022 if (dos_header->e_magic != IMAGE_DOS_SIGNATURE)
2020 goto unwind; 2023 goto unwind;
2021 2024
2022 nt_header = (PIMAGE_NT_HEADERS) ((char *) dos_header + 2025 nt_header = (PIMAGE_NT_HEADERS) ((Rawbyte *) dos_header +
2023 dos_header->e_lfanew); 2026 dos_header->e_lfanew);
2024 2027
2025 if ((char *) nt_header > (char *) dos_header + executable.size) 2028 if ((Rawbyte *) nt_header > (Rawbyte *) dos_header + executable.size)
2026 { 2029 {
2027 /* Some dos headers (pkunzip) have bogus e_lfanew fields. */ 2030 /* Some dos headers (pkunzip) have bogus e_lfanew fields. */
2028 *is_dos_app = TRUE; 2031 *is_dos_app = TRUE;
2029 } 2032 }
2030 else if (nt_header->Signature != IMAGE_NT_SIGNATURE && 2033 else if (nt_header->Signature != IMAGE_NT_SIGNATURE &&