diff options
Diffstat (limited to 'sys/compat')
-rw-r--r-- | sys/compat/ndis/pe_var.h | 6 | ||||
-rw-r--r-- | sys/compat/ndis/subr_ndis.c | 13 | ||||
-rw-r--r-- | sys/compat/ndis/subr_pe.c | 26 |
3 files changed, 17 insertions, 28 deletions
diff --git a/sys/compat/ndis/pe_var.h b/sys/compat/ndis/pe_var.h index 4eafc4c740c6..5178449c0b43 100644 --- a/sys/compat/ndis/pe_var.h +++ b/sys/compat/ndis/pe_var.h @@ -422,10 +422,8 @@ extern int pe_get_section(vm_offset_t, image_section_header *, const char *); extern int pe_relocate(vm_offset_t); extern int pe_get_import_descriptor(vm_offset_t, image_import_descriptor *, char *); extern int pe_patch_imports(vm_offset_t, char *, image_patch_table *); -#ifdef _KERNEL -extern int pe_get_messagetable(vm_offset_t, message_resource_data **); -extern int pe_get_message(vm_offset_t, uint32_t, char **, int *); -#endif +extern int pe_get_messagetable(vm_offset_t, message_resource_data **); +extern int pe_get_message(vm_offset_t, uint32_t, char **, int *, uint16_t *); __END_DECLS #endif /* _PE_VAR_H_ */ diff --git a/sys/compat/ndis/subr_ndis.c b/sys/compat/ndis/subr_ndis.c index b25208dae476..f2865717e5cd 100644 --- a/sys/compat/ndis/subr_ndis.c +++ b/sys/compat/ndis/subr_ndis.c @@ -795,12 +795,17 @@ ndis_syslog(ndis_handle adapter, ndis_error_code code, { ndis_miniport_block *block; va_list ap; - int i; - char *str = NULL; + int i, error; + char *str = NULL, *ustr = NULL; + uint16_t flags; block = (ndis_miniport_block *)adapter; - pe_get_message(block->nmb_img, code, &str, &i); + error = pe_get_message(block->nmb_img, code, &str, &i, &flags); + if (error == 0 && flags & MESSAGE_RESOURCE_UNICODE) { + ndis_unicode_to_ascii((uint16_t *)str, i, &ustr); + str = ustr; + } device_printf (block->nmb_dev, "NDIS ERROR: %x (%s)\n", code, str == NULL ? "unknown error" : str); device_printf (block->nmb_dev, "NDIS NUMERRORS: %x\n", numerrors); @@ -811,6 +816,8 @@ ndis_syslog(ndis_handle adapter, ndis_error_code code, va_arg(ap, void *)); va_end(ap); + if (ustr != NULL) + free(ustr, M_DEVBUF); return; } diff --git a/sys/compat/ndis/subr_pe.c b/sys/compat/ndis/subr_pe.c index 315159813bcc..0d6dc4497fc4 100644 --- a/sys/compat/ndis/subr_pe.c +++ b/sys/compat/ndis/subr_pe.c @@ -61,15 +61,6 @@ __FBSDID("$FreeBSD$"); #endif #include <compat/ndis/pe_var.h> -#ifdef _KERNEL -#include <machine/bus.h> -#include <machine/resource.h> -#include <sys/bus.h> -#include <sys/rman.h> -#include <compat/ndis/resource_var.h> -#include <compat/ndis/ntoskrnl_var.h> -#include <compat/ndis/ndis_var.h> -#endif static u_int32_t pe_functbl_match(image_patch_table *, char *); @@ -465,7 +456,6 @@ pe_get_import_descriptor(imgbase, desc, module) return (ENOENT); } -#ifdef _KERNEL int pe_get_messagetable(imgbase, md) vm_offset_t imgbase; @@ -513,17 +503,17 @@ pe_get_messagetable(imgbase, md) } int -pe_get_message(imgbase, id, str, len) +pe_get_message(imgbase, id, str, len, flags) vm_offset_t imgbase; uint32_t id; char **str; int *len; + uint16_t *flags; { message_resource_data *md = NULL; message_resource_block *mb; message_resource_entry *me; - int i; - char m[1024], *msg; + uint32_t i; pe_get_messagetable(imgbase, &md); @@ -540,14 +530,9 @@ pe_get_message(imgbase, id, str, len) for (i = id - mb->mrb_lowid; i > 0; i--) me = (message_resource_entry *)((uintptr_t)me + me->mre_len); - if (me->mre_flags == MESSAGE_RESOURCE_UNICODE) { - msg = m; - ndis_unicode_to_ascii((uint16_t *)me->mre_text, - me->mre_len, &msg); - *str = m; - } else - *str = me->mre_text; + *str = me->mre_text; *len = me->mre_len; + *flags = me->mre_flags; return(0); } mb++; @@ -555,7 +540,6 @@ pe_get_message(imgbase, id, str, len) return(ENOENT); } -#endif /* * Find the function that matches a particular name. This doesn't |