# ndisgen windrv script errors?



## dinkster (Dec 3, 2013)

Does anyone have a good windrv_stub.c file set up for a Linksys USB wireless card? I have a WUSB300N I'm trying to install Windows drivers for and when it gets to the kernel build part I get this error:


```
Building kernel module...In file included from /usr/share/misc/windrv_stub.c:57:
./windrv.h:147:4: error: unknown escape sequence '\p'
./windrv.h:147:4: error: unknown escape sequence '\H'
build failed. Exiting.
```

That's the farthest I get. I'm working on my PHP and real expression understanding, but I have no idea what this error means. I don't have a clue what the numbers indicate either. I thought maybe a line and column thing, but line 57 is commented out anyway. I could post the contents of the file if that would help anyone point me in the right direction.


----------



## fonz (Dec 4, 2013)

PHP? You probably mean C 

Anyway, it looks like the error is not in windrv_stub.c but in windrv.h on line 147. As it says, the former _includes_ the latter.

Posting the offending line and perhaps a few relevant lines of context might help. As far as I know the mentioned escape sequences \p and \H indeed do not exist. Moreover, they're not mentioned in K&R2. I checked.


----------



## dinkster (Dec 4, 2013)

Sure, I meant C. Line 57 in windrv_stub.c is commented out (i.e. #), but says

```
#include "windrv.h"
```
The thing is, after updating local.updatedb and searching for windrv.h, it's not on my installation. I only find windrv.c in src.


----------



## fonz (Dec 4, 2013)

dinkster said:
			
		

> Line 57 in windrv_stub.c is commented out (i.e. #), but says
> 
> ```
> #include "windrv.h"
> ```


You really are unfamiliar with C, right? In C (or C++, for that matter) # does not indicate a comment, it actually has a meaning (to get technical: lines beginning with # are _preprocessor directives_).

```
#include "windrv.h"
```
means _"include the file windrv.h here"_. It's exactly that instruction, not a comment. And that file windrv.h must be there somewhere, otherwise you would have gotten a different error (file not found). The output you posted clearly shows that the C compiler can find the file windrv.h and actually manages to parse it up to line 147 before giving up.


----------



## dinkster (Dec 4, 2013)

Thanks for your help, @fonz! Initially after doing a '`locate windrv.h`, I wasn't seeing the result because it was in /root/windrv.h, which was a short string result (in appearance) compared to the logged in shell prompt (that includes root@FreeBSD:~ #). I was expecting a longer string. At any rate, no matter what changes I made to line 147, anytime I tried ndisgen again I would get the same error and each time the windrv.h would be rewritten. I surmised ndiscvt was recreating windrv.h each time during the conversion of the Windows drivers, so I went into the .inf file of the Windows drivers and located the text associated with what line 147 of windrv.h was saying (something to the effect of HTMode Enabled). There was a missing comma at the end of the line. Afterward, ndisgen worked fine and created drivers. However, whenever I `kldload` the driver the system goes into a kernel panic mode (I'm assuming) and reboots itself. It literally hangs for a minute, then reboots. After removing the driver and starting over I got it to load, and `kldstat` even showed it. However, `ifconfig` did not come up with an ndis0 interface. I rebooted my computer and tried `kldload` again and the system reboots once again. I haven't got a clue at this point. I can't find any associated logs in /var/log that tell me anything.


----------

