Why does dcraw_process make my brownish colors blue?

Hi all,

I'm running into a weird issue with my dcraw_process function making my image weirdly colored. Here's some code I'm using:

RawProcessor.imgdata.params.use_camera_wb = 1;
RawProcessor.imgdata.params.no_auto_bright = 0;
RawProcessor.imgdata.params.exp_correc = 1.0;
RawProcessor.imgdata.params.exp_shift = 4.0;
RawProcessor.imgdata.params.exp_preser = 1.0;
RawProcessor.imgdata.params.gamm[0] = RawProcessor.imgdata.params.gamm[1] = 1;
RawProcessor.imgdata.params.adjust_maximum_thr = 0.0; 
//	This metric tells us which way the picture was actually taken so that we can 
//	take the landscape raw values and rotate them appropriately during output.
n_orientation = RawProcessor.imgdata.sizes.flip;
//	sets pointer to LibRaw internal structure of raw data:
n_raw_input_vector = &RawProcessor.imgdata.rawdata.raw_image[0];
//	set color max value:
n_color_max_value = RawProcessor.imgdata.rawdata.color.maximum;
int check = RawProcessor.dcraw_process();
libraw_processed_image_t *img_ptr = RawProcessor.dcraw_make_mem_image(&check);
l_output_file_name = l_output_file_folder;
l_output_file_name += "\\test.png";
image.Create(img_ptr->width, img_ptr->height, 24);
bitmap.SetBitmapBits(img_ptr->data_size, img_ptr->data);
image.Save((LPCTSTR)l_output_file_name.c_str(), Gdiplus::ImageFormatPNG);

I'll attach two files, one being the a portion of the original NEF and the other being the converted image. Why is it that by brown colors have become so blue, and the water is so dark? Thanks a ton for any help!