void ColorMap::insertControlPoint(double newControlPointValue,const ColorMap::ColorMapValue& newControlPointColor) { /* Insert the new control point if it is inside the value range: */ if(newControlPointValue>=valueRange.first&&newControlPointValue<=valueRange.second) { /* Find the two control points on either side of the new control point: */ ControlPoint* cpPtr1=&first; ControlPoint* cpPtr2; for(cpPtr2=cpPtr1->right;cpPtr2!=&last&&cpPtr2->value<newControlPointValue;cpPtr1=cpPtr2,cpPtr2=cpPtr2->right) ; /* Insert the new control point: */ ControlPoint* newCp=new ControlPoint(newControlPointValue,newControlPointColor); newCp->left=cpPtr1; cpPtr1->right=newCp; newCp->right=cpPtr2; cpPtr2->left=newCp; /* Update all control points: */ updateControlPoints(); { /* Call the color map change callbacks: */ ColorMapChangedCallbackData cbData(this); colorMapChangedCallbacks.call(&cbData); } { /* Select the new control point: */ SelectedControlPointChangedCallbackData cbData(this,selected,newCp); selected=newCp; selectedControlPointChangedCallbacks.call(&cbData); } } }
void InputDevice::setSingleButtonPressed(int index) { for(int i=0;i<numButtons;++i) { if(i!=index) { if(buttonStates[i]) { buttonStates[i]=false; if(callbacksEnabled) { ButtonCallbackData cbData(this,i,false); buttonCallbacks[i].call(&cbData); } } } } ButtonCallbackData cbData(this,index,true); if(!buttonStates[index]) { buttonStates[index]=true; if(callbacksEnabled) buttonCallbacks[index].call(&cbData); } }
void ColorMap::deleteSelectedControlPoint(void) { /* Remove the selected control point if possible: */ if(selected!=0&&selected!=&first&&selected!=&last) { ControlPoint* delPtr=selected; { /* Unselect the selected control point: */ SelectedControlPointChangedCallbackData cbData(this,selected,0); selected=0; selectedControlPointChangedCallbacks.call(&cbData); } /* Remove the control point from the list: */ delPtr->left->right=delPtr->right; delPtr->right->left=delPtr->left; delete delPtr; /* Update all control points: */ updateControlPoints(); { /* Call the color map change callbacks: */ ColorMapChangedCallbackData cbData(this); colorMapChangedCallbacks.call(&cbData); } } }
void ColorMap::pointerMotion(Event& event) { if(isDragging) { /* Calculate the new value and opacity: */ GLfloat x1=colorMapAreaBox.getCorner(0)[0]; GLfloat x2=colorMapAreaBox.getCorner(1)[0]; GLfloat y1=colorMapAreaBox.getCorner(0)[1]; GLfloat y2=colorMapAreaBox.getCorner(2)[1]; Point p=event.getWidgetPoint().getPoint()-dragOffset; double newValue=(p[0]-double(x1))*(valueRange.second-valueRange.first)/double(x2-x1)+valueRange.first; if(selected==&first) newValue=valueRange.first; else if(selected==&last) newValue=valueRange.second; else if(newValue<selected->left->value) newValue=selected->left->value; else if(newValue>selected->right->value) newValue=selected->right->value; GLfloat newOpacity=(p[1]-y1)*(1.0f-0.0f)/(y2-y1)+0.0f; if(newOpacity<0.0f) newOpacity=0.0f; else if(newOpacity>1.0f) newOpacity=1.0f; selected->value=newValue; selected->color[3]=newOpacity; /* Update all control points: */ updateControlPoints(); /* Call the color map change callbacks: */ ColorMapChangedCallbackData cbData(this); colorMapChangedCallbacks.call(&cbData); } }
void FileSelectionDialog::listItemSelectedCallback(ListBox::ItemSelectedCallbackData* cbData) { /* Get the selected list item's name: */ std::string item=cbData->listBox->getItem(cbData->selectedItem); /* Check if it's a file or directory: */ if(item[item.size()-1]=='/') { /* Remove all path buttons after the selected one: */ for(GLint i=pathButtonBox->getNumColumns()-1;i>selectedPathButton;--i) pathButtonBox->removeWidgets(i); /* Add a new path button for the selected directory: */ item.erase(item.end()-1); char pathButtonName[20]; snprintf(pathButtonName,sizeof(pathButtonName),"PathButton%04d",selectedPathButton); Button* pathButton=new Button(pathButtonName,pathButtonBox,item.c_str()); pathButton->setBorderWidth(pathButton->getBorderWidth()*0.5f); pathButton->getSelectCallbacks().add(this,&FileSelectionDialog::pathButtonSelectedCallback); /* Select the new path button: */ setSelectedPathButton(selectedPathButton+1); } else { /* Assemble the fully qualified name of the selected file: */ std::string selectedFileName=getCurrentPath(); selectedFileName.push_back('/'); selectedFileName+=item; /* Call the OK callbacks: */ OKCallbackData cbData(this,selectedFileName); okCallbacks.call(&cbData); } }
void NewButton::setArmed(bool newArmed) { if(newArmed&&!isArmed) { /* Arm the button: */ savedBorderType=getBorderType(); savedBackgroundColor=backgroundColor; SingleChildContainer::setBorderType(savedBorderType!=Widget::LOWERED?Widget::LOWERED:Widget::RAISED); // Need to use base class method here SingleChildContainer::setBackgroundColor(armedBackgroundColor); // Need to use base class method here if(child!=0) child->setBackgroundColor(armedBackgroundColor); isArmed=true; } else if(!newArmed&&isArmed) { /* Disarm the button: */ SingleChildContainer::setBorderType(savedBorderType); // Need to use base class method here SingleChildContainer::setBackgroundColor(savedBackgroundColor); // Need to use base class method here if(child!=0) child->setBackgroundColor(savedBackgroundColor); isArmed=false; } /* Call the arm callbacks: */ ArmCallbackData cbData(this,isArmed); armCallbacks.call(&cbData); }
static int MD5CBFn_File(MD5CBData *pData) { MD5CBFn_File_data* cbData((MD5CBFn_File_data*)pData->pUserData); cbData->percentage.SetTototal(pData->totalSize); cbData->percentage.Update(pData->done); return cbData->pFilter->GetDlg()->IsSearchCancelled(); }
void RadioBox::childrenValueChangedCallbackWrapper(Misc::CallbackData* callbackData,void* userData) { /* Extract the widget pointers: */ ToggleButton::ValueChangedCallbackData* cbStruct=static_cast<ToggleButton::ValueChangedCallbackData*>(callbackData); RadioBox* thisPtr=static_cast<RadioBox*>(userData); /* Change the radio box' state: */ ToggleButton* oldSelectedToggle=thisPtr->selectedToggle; if(cbStruct->set) { /* Unset the previously selected toggle: */ if(oldSelectedToggle!=0&&oldSelectedToggle!=cbStruct->toggle) oldSelectedToggle->setToggle(false); /* Set the new toggle: */ thisPtr->selectedToggle=cbStruct->toggle; } else if(cbStruct->toggle==oldSelectedToggle) { if(thisPtr->selectionMode==ALWAYS_ONE) // We can't allow the selected toggle to just unselect itself! oldSelectedToggle->setToggle(true); else thisPtr->selectedToggle=0; } /* Call the value changed callbacks: */ RadioBox::ValueChangedCallbackData cbData(thisPtr,oldSelectedToggle,thisPtr->selectedToggle); thisPtr->valueChangedCallbacks.call(&cbData); }
void ColorMap::createColorMap(const std::vector<ColorMap::ControlPoint>& controlPoints) { /* Check if the control point vector is valid: */ if(controlPoints.size()<2) Misc::throwStdErr("ColorMap::createColorMap: control point vector has less than two control points"); for(std::vector<ColorMap::ControlPoint>::const_iterator cpIt=controlPoints.begin();cpIt!=controlPoints.end();++cpIt) { std::vector<ColorMap::ControlPoint>::const_iterator cpIt2=cpIt; ++cpIt2; if(cpIt2!=controlPoints.end()) if(cpIt->value>cpIt2->value) Misc::throwStdErr("ColorMap::createColorMap: control point vector has decreasing control point values"); } /* Delete the current color map: */ deleteColorMap(); /* Copy all control points from the control point array: */ int numPointsSet=0; for(std::vector<ColorMap::ControlPoint>::const_iterator cpIt=controlPoints.begin();cpIt!=controlPoints.end();++cpIt) { if(numPointsSet==0) { /* Set the first control point: */ first.value=cpIt->value; first.color=cpIt->color; } else { if(numPointsSet>1) { /* Copy the last control point to an intermediate one: */ ControlPoint* newCp=new ControlPoint(last.value,last.color); newCp->left=last.left; newCp->left->right=newCp; newCp->right=&last; last.left=newCp; } /* Set the last control point: */ last.value=cpIt->value; last.color=cpIt->color; } ++numPointsSet; } /* Update the value range: */ valueRange.first=first.value; valueRange.second=last.value; /* Update all control points: */ updateControlPoints(); /* Call the color map change callbacks: */ ColorMapChangedCallbackData cbData(this); colorMapChangedCallbacks.call(&cbData); }
void ColorMapEditor:: pointerButtonDown(Event& event) { //find the closest control point to the event's location GLfloat minDist2 = Math::sqr(controlPointSize*1.5f); int newSelected = -1; GLfloat x1 = colorMapAreaBox.getCorner(0)[0]; GLfloat x2 = colorMapAreaBox.getCorner(1)[0]; int numPoints = static_cast<int>(controlPoints.size()); for (int i=0; i<numPoints; ++i) { const Point& cp = controlPoints[i]; GLfloat dist2 = Geometry::sqrDist(cp,event.getWidgetPoint().getPoint()); if (minDist2 > dist2) { minDist2 = dist2; newSelected = i; for (int j=0; j<2; ++j) { dragOffset[j] = Point::Vector::Scalar( event.getWidgetPoint().getPoint()[j] - cp[j]); } dragOffset[2] = Point::Vector::Scalar(0); } } //create a new control point if none was selected Misc::ColorMap::ValueRange vr = colorMap.getValueRange(); if (newSelected == -1) { //compute the value of the current click-point double remap = (vr.max - vr.min) / double(x2 - x1); double newValue = (event.getWidgetPoint().getPoint()[0] - double(x1)); newValue = vr.min + newValue * remap; //clamp it to the value range newValue = std::max(newValue, vr.min); newValue = std::min(newValue, vr.max); //select the inserted point selected = insertControlPoint(newValue); } else if(newSelected == selected) { //start dragging the selected control point isDragging = true; } else { //call callbacks if selected control point has changed SelectedControlPointChangedCallbackData cbData(this, selected, newSelected); selected = newSelected; selectedControlPointChangedCallbacks.call(&cbData); } }
void InputDevice::setButtonState(int index,bool newButtonState) { ButtonCallbackData cbData(this,index,newButtonState); if(buttonStates[index]!=newButtonState) { buttonStates[index]=newButtonState; if(callbacksEnabled) buttonCallbacks[index].call(&cbData); } }
void DragWidget::stopDragging(Event&) { if(isDragging) { /* Stop dragging: */ isDragging=false; DraggingCallbackData cbData(this,DraggingCallbackData::DRAGGING_STOPPED); draggingCallbacks.call(&cbData); } }
void DragWidget::startDragging(Event&) { if(!isDragging) { /* Start dragging: */ isDragging=true; DraggingCallbackData cbData(this,DraggingCallbackData::DRAGGING_STARTED); draggingCallbacks.call(&cbData); } }
void InputDeviceManager::updateInputDevices(void) { /* Grab new data from all input device adapters: */ for(int i=0;i<numInputDeviceAdapters;++i) inputDeviceAdapters[i]->updateInputDevices(); /* Call the update callbacks: */ InputDeviceUpdateCallbackData cbData(this); inputDeviceUpdateCallbacks.call(&cbData); }
void ColorMapEditor:: touch() { //update all control points updateControlPoints(); //call the color map change callbacks: */ ColorMapChangedCallbackData cbData(this); colorMapChangedCallbacks.call(&cbData); }
void Menu::childrenSelectCallbackWrapper(Misc::CallbackData* callbackData,void* userData) { /* Extract the widget pointers: */ Button::SelectCallbackData* cbStruct=static_cast<Button::SelectCallbackData*>(callbackData); Menu* thisPtr=static_cast<Menu*>(userData); /* Call the entry select callbacks: */ EntrySelectCallbackData cbData(thisPtr,cbStruct->button,cbStruct); thisPtr->entrySelectCallbacks.call(&cbData); }
void InputDevice::setValuator(int index,double value) { ValuatorCallbackData cbData(this,index,valuatorValues[index],value); if(valuatorValues[index]!=value) { valuatorValues[index]=value; if(callbacksEnabled) valuatorCallbacks[index].call(&cbData); } }
int Registry(int isitget, const char *keyName, char *ItemName, char *buffer, char *errstr) { bool done(false); char achClass[MAX_PATH], achValue[MAX_VALUE_NAME]; DWORD cchClassName(MAX_PATH), cSubKeys(0), cbMaxSubKey, cchMaxClass, cValues, cchMaxValue, cbMaxValueData, cbSecurityDescriptor, cchValue(MAX_VALUE_NAME); DWORD retCode, i; FILETIME ftLastWriteTime; // last write time HKEY key; DWORD dw(0), dwres, dwType, cbData(MAX_PATH); BYTE btdata[MAX_PATH]; achClass[0]='\0'; LONG ln = RegCreateKeyEx( HKEY_CURRENT_USER, keyName, 0, NULL, 0, KEY_ALL_ACCESS, NULL, &key, &dwres); if (!isitget) // Set values in the registry { if (RegSetValueEx(key, ItemName, 0, REG_SZ, (const BYTE*)&buffer[0], (DWORD)strlen(buffer))!=ERROR_SUCCESS) { strcpy(errstr,"error on RegSetValueEx()"); return 0; } } else // Get values from the registry { if (dwres==REG_CREATED_NEW_KEY) { strcpy(errstr,"The registry key does not exist (just created now)"); return 0; } else if (dwres==REG_OPENED_EXISTING_KEY) { retCode = RegQueryInfoKey(key, achClass, &cchClassName, NULL, &cSubKeys, &cbMaxSubKey, &cchMaxClass, &cValues, &cchMaxValue, &cbMaxValueData, &cbSecurityDescriptor, &ftLastWriteTime); if (cValues) { for (i=0, retCode=ERROR_SUCCESS; i<cValues; i++) { achValue[0] = '\0'; cchValue = cbData = MAX_PATH; retCode = RegEnumValue(key, i, achValue, &cchValue, NULL, &dwType, btdata, &cbData); if (retCode == ERROR_SUCCESS) { if (!strcmp(achValue,ItemName)) { done = true; strcpy(buffer, (LPCSTR)btdata); } } else { strcpy(errstr,"error on RegEnumValue()"); return 0; } } if (!done) { sprintf(errstr,"The registry key item %s does not exist.",ItemName ); return 0; } } else { sprintf(errstr,"No key associated with %s found.", keyName); return 0; } } } RegCloseKey(key); return 1; }
void InputDevice::enableCallbacks(void) { callbacksEnabled=true; /* Call callbacks for everything that has changed, to update the user program's state: */ CallbackData trackingCbData(this); trackingCallbacks.call(&trackingCbData); for(int i=0;i<numButtons;++i) if(savedButtonStates[i]!=buttonStates[i]) { ButtonCallbackData cbData(this,i,buttonStates[i]); buttonCallbacks[i].call(&cbData); } for(int i=0;i<numValuators;++i) if(savedValuatorValues[i]!=valuatorValues[i]) { ValuatorCallbackData cbData(this,i,savedValuatorValues[i],valuatorValues[i]); valuatorCallbacks[i].call(&cbData); } }
void ColorMapEditor:: selectControlPoint(int controlPointIndex) { if (controlPointIndex<static_cast<int>(controlPoints.size())) { SelectedControlPointChangedCallbackData cbData(this, selected, controlPointIndex); selected = controlPointIndex; selectedControlPointChangedCallbacks.call(&cbData); } }
InputDevice* InputDeviceManager::createInputDevice(const char* deviceName,int trackType,int numButtons,int numValuators,bool physicalDevice) { /* Get the length of the given device name's prefix: */ int deviceNamePrefixLength=getPrefixLength(deviceName); /* Check if a device of the same name prefix already exists: */ bool exists=false; int maxAliasIndex=0; for(InputDevices::iterator devIt=inputDevices.begin();devIt!=inputDevices.end();++devIt) { /* Compare the two prefixes: */ if(getPrefixLength(devIt->getDeviceName())==deviceNamePrefixLength&&strncmp(deviceName,devIt->getDeviceName(),deviceNamePrefixLength)==0) { exists=true; if(devIt->getDeviceName()[deviceNamePrefixLength]==':') { int aliasIndex=atoi(devIt->getDeviceName()+deviceNamePrefixLength); if(maxAliasIndex<aliasIndex) maxAliasIndex=aliasIndex; } } } /* Create a new (uninitialized) input device: */ InputDevices::iterator newDevice=inputDevices.insert(inputDevices.end(),InputDevice()); InputDevice* newDevicePtr=&(*newDevice); // This looks iffy, but I don't know of a better way /* Initialize the new input device: */ if(exists) { /* Create a new alias name for the new device: */ char newDeviceNameBuffer[256]; strncpy(newDeviceNameBuffer,deviceName,deviceNamePrefixLength); snprintf(newDeviceNameBuffer+deviceNamePrefixLength,sizeof(newDeviceNameBuffer)-deviceNamePrefixLength,":%d",maxAliasIndex+1); newDevicePtr->set(newDeviceNameBuffer,trackType,numButtons,numValuators); } else newDevicePtr->set(deviceName,trackType,numButtons,numValuators); /* Add the new input device to the input graph: */ inputGraphManager->addInputDevice(newDevicePtr); /* If it's a physical device, grab it permanently: */ if(physicalDevice) inputGraphManager->grabInputDevice(newDevicePtr,0); // Passing in null as grabber grabs for the physical layer /* Call the input device creation callbacks: */ InputDeviceCreationCallbackData cbData(this,newDevicePtr); inputDeviceCreationCallbacks.call(&cbData); /* Return a pointer to the new input device: */ return newDevicePtr; }
void ColorMap::selectControlPoint(int controlPointIndex) { ControlPoint* cpPtr=0; if(controlPointIndex>=0) for(cpPtr=&first;controlPointIndex>0&&cpPtr!=0;cpPtr=cpPtr->right,--controlPointIndex) ; /* Select the new control point: */ SelectedControlPointChangedCallbackData cbData(this,selected,cpPtr); selected=cpPtr; selectedControlPointChangedCallbacks.call(&cbData); }
void MenuTool::deactivate(void) { if(active) { /* Call deactivation callbacks: */ DeactivationCallbackData cbData(this); deactivationCallbacks.call(&cbData); /* Deactivate the tool: */ menu->unlockMenu(this); active=false; } }
void InputDevice::setTransformation(const TrackerState& newTransformation) { /* Set transformation: */ transformation=newTransformation; /* Call callbacks: */ if(callbacksEnabled) { /* Call all tracking callbacks: */ CallbackData cbData(this); trackingCallbacks.call(&cbData); } }
void GLContextData::makeCurrent(GLContextData* newCurrentContextData) { if(newCurrentContextData!=currentContextData) { /* Create the callback data object: */ CurrentContextDataChangedCallbackData cbData(currentContextData,newCurrentContextData); /* Set the current context data object: */ currentContextData=newCurrentContextData; /* Call all callbacks: */ currentContextDataChangedCallbacks.call(&cbData); } }
void InputDevice::clearButtonStates(void) { for(int i=0;i<numButtons;++i) { if(buttonStates[i]) { buttonStates[i]=false; if(callbacksEnabled) { ButtonCallbackData cbData(this,i,false); buttonCallbacks[i].call(&cbData); } } } }
void ColorMap::createColorMap(ColorMap::ColorMapCreationType colorMapType,const ColorMap::ValueRange& newValueRange) { /* Delete the current color map: */ deleteColorMap(); /* Update the value range: */ valueRange=newValueRange; if(colorMapType==GREYSCALE) { /* Create a greyscale color map: */ first.value=valueRange.first; first.color=ColorMapValue(0.0f,0.0f,0.0f,0.0f); last.value=valueRange.second; last.color=ColorMapValue(1.0f,1.0f,1.0f,1.0f); } else if(colorMapType==LUMINANCE) { } else { /* Create a rainbow color map: */ first.value=valueRange.first; first.color=ColorMapValue(1.0f,0.0f,0.0f,0.0f); ControlPoint* cs[6]; cs[0]=&first; cs[1]=new ControlPoint((1.0/5.0)*(valueRange.second-valueRange.first)+valueRange.first,ColorMapValue(1.0f,1.0f,0.0f,1.0f/5.0f)); cs[2]=new ControlPoint((2.0/5.0)*(valueRange.second-valueRange.first)+valueRange.first,ColorMapValue(0.0f,1.0f,0.0f,2.0f/5.0f)); cs[3]=new ControlPoint((3.0/5.0)*(valueRange.second-valueRange.first)+valueRange.first,ColorMapValue(0.0f,1.0f,1.0f,3.0f/5.0f)); cs[4]=new ControlPoint((4.0/5.0)*(valueRange.second-valueRange.first)+valueRange.first,ColorMapValue(0.0f,0.0f,1.0f,4.0f/5.0f)); cs[5]=&last; last.value=valueRange.second; last.color=ColorMapValue(1.0f,0.0f,1.0f,1.0f); for(int i=0;i<5;++i) { cs[i+1]->left=cs[i]; cs[i]->right=cs[i+1]; } } /* Update all control points: */ updateControlPoints(); /* Call the color map change callbacks: */ ColorMapChangedCallbackData cbData(this); colorMapChangedCallbacks.call(&cbData); }
void ColorMap::setSelectedControlPointColorValue(const ColorMap::ColorMapValue& newControlPointColorValue) { if(selected!=0) { /* Set the control point's color value's RGB and alpha components: */ for(int i=0;i<4;++i) selected->color[i]=newControlPointColorValue[i]; /* Update all control points: */ updateControlPoints(); /* Call the color map change callbacks: */ ColorMapChangedCallbackData cbData(this); colorMapChangedCallbacks.call(&cbData); } }
void ColorMapEditor:: updateControlPoints(bool propagate) { //- make sure the control points match the managed color map Misc::ColorMap::Points& points = colorMap.getPoints(); int numPoints = static_cast<int>(points.size()); if (static_cast<int>(controlPoints.size()) != numPoints) { //deselect if (hasSelectedControlPoint()) { if (propagate) { SelectedControlPointChangedCallbackData cbData(this, selected, -1); selected = -1; selectedControlPointChangedCallbacks.call(&cbData); } else selected = -1; } //reassign the control points controlPoints.resize(numPoints); } //- update the visual representation GLfloat x1 = colorMapAreaBox.getCorner(0)[0]; GLfloat x2 = colorMapAreaBox.getCorner(1)[0]; GLfloat width = x2 - x1; GLfloat y1 = colorMapAreaBox.getCorner(0)[1]; GLfloat y2 = colorMapAreaBox.getCorner(2)[1]; GLfloat height = y2 - y1; Misc::ColorMap::ValueRange range = colorMap.getValueRange(); Misc::ColorMap::Value invRangeWidth = 1.0 / (range.max - range.min); for (int i=0; i<numPoints; ++i) { ControlPoint& cp = controlPoints[i]; const Misc::ColorMap::Point& p = points[i]; cp[0] = x1 + GLfloat(invRangeWidth*(p.value - range.min)) * width; cp[1] = y1 + p.color[3] * height; cp[2] = colorMapAreaBox.getCorner(0)[2]; } }
BOOL CRegistryCfg::SetEntropy(LPBYTE lpbEntropy, DWORD cbEntropy) { if(IsBadReadPtr(lpbEntropy, cbEntropy)) { ::SetLastError(ERROR_INVALID_PARAMETER); return FALSE; } // memory to encrypt must be a multiple of CRYPTPROTECTMEMORY_BLOCK_SIZE. DWORD dwMod = cbEntropy % CRYPTPROTECTMEMORY_BLOCK_SIZE; DWORD cbData(0); if (0 == dwMod) { cbData = cbEntropy + (CRYPTPROTECTMEMORY_BLOCK_SIZE - dwMod); } else { cbData = cbEntropy; } LPBYTE lpb = (LPBYTE) ::LocalAlloc(LPTR, cbData); if (NULL == lpb) { return FALSE; } ::CopyMemory(lpb, lpbEntropy, cbEntropy); #ifdef USE_CRYPT_PROTECT_MEMORY BOOL fSuccess = ::CryptProtectMemory( lpb, cbData, CRYPTPROTECTMEMORY_SAME_PROCESS); if (!fSuccess) { ::SecureZeroMemory(lpb, cbData); ::LocalFree(lpb); return FALSE; } #endif if (m_Entropy.pbData) { ::SecureZeroMemory(m_Entropy.pbData, m_Entropy.cbData); ::LocalFree(m_Entropy.pbData); } m_bEntropyProtected = TRUE; m_Entropy.pbData = lpb; m_Entropy.cbData = cbData; return TRUE; }