SRSetRestorePoint API creates a restore point bu not when system
protection is disabled
I am working on a POC where in I need to develop an application on Win7
and Win8, pure C++ win32 application, that modifies (like installs or
un-installs) the system. Before that the application has to create a
system restore point. I cannot use .net or C++/CLI.
I googled and found the below link
http://msdn.microsoft.com/en-us/library/windows/desktop/aa378987(v=vs.85).aspx
With this (SRSetRestorePoint API) I am able to create the system restore
point (application gets the required admin privilege). But I am facing the
following issues
1) If system restore or protection is disabled or turned off, then the API
fails and will not create restore point. Is there any such APIs (no .net
method, only C++) using which I can enable system protection if turned off
or disabled?
2) Though the restore point is getting created, it is not appearing in the
"Recommended restore:" dialog in Computer->Properties->System Protection->
System Restore. This is where a newly and recently created restore point
appears. But with this API it is not. However, if we select, "Choose a
different restore point" option, then the created restore point appears in
that list.
Is there a way or what needs to be done to make the created restore point
(created using SRSetRestorePoint API) appear in "Recommended restore:"?
Code snippet:
RESTOREPOINTINFO RstPt;
STATEMGRSTATUS MgrStat;
DWORD dwErr = ERROR_SUCCESS;
RstPt.dwRestorePtType = APPLICATION_UNINSTALL;
RstPt.dwEventType = BEGIN_SYSTEM_CHANGE;
_tcscpy(RstPt.szDescription, _T("Demo Restore Point"));
if (!SRSetRestorePoint(&RstPt, &MgrStat))
{
dwErr = MgrStat.nStatus;
if(dwErr == ERROR_SERVICE_DISABLED)
{
//What to do in this case?
}
return FALSE;
}
RstPt.dwEventType = END_SYSTEM_CHANGE;
RstPt.llSequenceNumber = MgrStat.llSequenceNumber;
if (!SRSetRestorePoint(&RstPt, &MgrStat))
{
return FALSE;
}
Any help or pointers will be appreciated.
Thanks in advance. .
Brutsch
Sunday, 1 September 2013
View network activity for browser child window
View network activity for browser child window
I need to reverse-engineer some javascript application which does
authorization using facebook auth.
Facebook auth window pops up, asks for my permissions, and gets closed
instantly, so I am unable to grasp anything from the performed action, as
it's too fast.
The problem is that neither Chrome DevTools, nor Firefox Firebug does
display network activity for child windows like OAuth permission.
Is there a way to enable FULL network log? An extension, whatever? (It
better be free and easy to use)
I need to reverse-engineer some javascript application which does
authorization using facebook auth.
Facebook auth window pops up, asks for my permissions, and gets closed
instantly, so I am unable to grasp anything from the performed action, as
it's too fast.
The problem is that neither Chrome DevTools, nor Firefox Firebug does
display network activity for child windows like OAuth permission.
Is there a way to enable FULL network log? An extension, whatever? (It
better be free and easy to use)
Given URL is not allowed by the Application configuration.: One or more of the given URLs is not
Given URL is not allowed by the Application configuration.: One or more of
the given URLs is not
I am getting this error while i try to fetch data.. Given URL is not
allowed by the Application configuration.: One or more of the given URLs
is not allowed by the App's settings. It must match the Website URL or
Canvas URL, or the domain must be a subdomain of one of the App's domains.
the given URLs is not
I am getting this error while i try to fetch data.. Given URL is not
allowed by the Application configuration.: One or more of the given URLs
is not allowed by the App's settings. It must match the Website URL or
Canvas URL, or the domain must be a subdomain of one of the App's domains.
Saturday, 31 August 2013
QtCreator GUI open text file
QtCreator GUI open text file
I made a push button that will browse and get a textfile. But I need to
open it in a new window to check if the content of the textfile is
correct. How do I do this?
Also, I would like to have a line edit right next to the button that shows
which file I'm looking at. In other words, the directory of the file that
is opened through the button.
Currently, this is what I have:
void MainWindow::on_fileButton_clicked()
{
QString fileName1 = QFileDialog::getOpenFileName(this,tr("Open Text
File"), "", tr("Text Files (*.txt)"));
QFile file1(fileName1);
if(!file1.open(QIODevice::ReadOnly | QIODevice::Text))
return;
QTextStream in(&file1);
while(!in.atEnd()){
QString line = in.readLine();
}
}
I made a push button that will browse and get a textfile. But I need to
open it in a new window to check if the content of the textfile is
correct. How do I do this?
Also, I would like to have a line edit right next to the button that shows
which file I'm looking at. In other words, the directory of the file that
is opened through the button.
Currently, this is what I have:
void MainWindow::on_fileButton_clicked()
{
QString fileName1 = QFileDialog::getOpenFileName(this,tr("Open Text
File"), "", tr("Text Files (*.txt)"));
QFile file1(fileName1);
if(!file1.open(QIODevice::ReadOnly | QIODevice::Text))
return;
QTextStream in(&file1);
while(!in.atEnd()){
QString line = in.readLine();
}
}
NSOutlineView drag promises with directories
NSOutlineView drag promises with directories
How does one implement an NSOutlineViewDataSource to allow dragging
directories that do not exist in the file system at the time of dragging
to the Finder? I have searched and searched and read a ton of the
documentation, but have had great difficulty finding anything of value
that works. I use a custom data source that manages a file system-like
tree, and all the items are instances of a class that keeps track of its
path. I would like to be able to drag files and directories out of the
outline view into the Finder.
I have:
- (BOOL)outlineView:(NSOutlineView *)outlineView writeItems:(NSArray
*)items toPasteboard:(NSPasteboard *)pasteboard {
NSMutableArray *types = [NSMutableArray array];
for (JOItemInfo *itemInfo in items) {
NSString *extension = itemInfo.name.pathExtension;
if (extension.length > 0) [types addObject:extension];
}
[pasteboard declareTypes:@[(__bridge_transfer NSString
*)kPasteboardTypeFileURLPromise] owner:self];
[pasteboard setPropertyList:types forType:(__bridge_transfer
NSString *)kPasteboardTypeFileURLPromise];
DDLogInfo(@"Wrote types %@ to pasteboard %@ for key %@", types,
pasteboard, (__bridge_transfer NSString
*)kPasteboardTypeFileURLPromise);
return YES;
}
and an implementation of
-outlineView:namesOfPromisedFilesDroppedAtDestination:forDraggedItems:
that writes the items inside of the given path. This works in that I can
drag items out to the Finder, but when I let go nothing else happens, and
the -...namesOfPromisedFilesDropped... method isn't even called. Also,
[self.outlineView
setDraggingDestinationFeedbackStyle:NSTableViewDraggingDestinationFeedbackStyleRegular];
[self.outlineView setDraggingSourceOperationMask:NSDragOperationNone
forLocal:YES];
[self.outlineView setDraggingSourceOperationMask:NSDragOperationCopy
forLocal:NO];
is in my -awakeFromNib. The if (extension.length > 0) ... was based on an
example I found somewhere, but it was dated, and the documentation says to
return an extension, so I think that is appropriate. Personally, I find
the documentation for this whole area very lacking, especially in regard
to an NSOutlineView. Thanks!
Update: I changed (__bridge_transfer NSString
*)kPasteboardTypeFileURLPromise to NSFilesPromisePboardType, and I can now
drag files (with an extension at least) and they can be dropped
successfully in the Finder. (I had used the former b/c the documentation
for the latter recommended that, but they do not have the same effect.)
Directories and files without an extension still can't be dragged.
How does one implement an NSOutlineViewDataSource to allow dragging
directories that do not exist in the file system at the time of dragging
to the Finder? I have searched and searched and read a ton of the
documentation, but have had great difficulty finding anything of value
that works. I use a custom data source that manages a file system-like
tree, and all the items are instances of a class that keeps track of its
path. I would like to be able to drag files and directories out of the
outline view into the Finder.
I have:
- (BOOL)outlineView:(NSOutlineView *)outlineView writeItems:(NSArray
*)items toPasteboard:(NSPasteboard *)pasteboard {
NSMutableArray *types = [NSMutableArray array];
for (JOItemInfo *itemInfo in items) {
NSString *extension = itemInfo.name.pathExtension;
if (extension.length > 0) [types addObject:extension];
}
[pasteboard declareTypes:@[(__bridge_transfer NSString
*)kPasteboardTypeFileURLPromise] owner:self];
[pasteboard setPropertyList:types forType:(__bridge_transfer
NSString *)kPasteboardTypeFileURLPromise];
DDLogInfo(@"Wrote types %@ to pasteboard %@ for key %@", types,
pasteboard, (__bridge_transfer NSString
*)kPasteboardTypeFileURLPromise);
return YES;
}
and an implementation of
-outlineView:namesOfPromisedFilesDroppedAtDestination:forDraggedItems:
that writes the items inside of the given path. This works in that I can
drag items out to the Finder, but when I let go nothing else happens, and
the -...namesOfPromisedFilesDropped... method isn't even called. Also,
[self.outlineView
setDraggingDestinationFeedbackStyle:NSTableViewDraggingDestinationFeedbackStyleRegular];
[self.outlineView setDraggingSourceOperationMask:NSDragOperationNone
forLocal:YES];
[self.outlineView setDraggingSourceOperationMask:NSDragOperationCopy
forLocal:NO];
is in my -awakeFromNib. The if (extension.length > 0) ... was based on an
example I found somewhere, but it was dated, and the documentation says to
return an extension, so I think that is appropriate. Personally, I find
the documentation for this whole area very lacking, especially in regard
to an NSOutlineView. Thanks!
Update: I changed (__bridge_transfer NSString
*)kPasteboardTypeFileURLPromise to NSFilesPromisePboardType, and I can now
drag files (with an extension at least) and they can be dropped
successfully in the Finder. (I had used the former b/c the documentation
for the latter recommended that, but they do not have the same effect.)
Directories and files without an extension still can't be dragged.
Put on screen controller(Up,Down,Left,Right) Actions
Put on screen controller(Up,Down,Left,Right) Actions
TouchCollection touchCollection = TouchPanel.GetState();
foreach (TouchLocation tl in touchCollection)
{
if (tl.State == TouchLocationState.Pressed)
{
position.Y = position.Y - speed;
}
if (tl.State == TouchLocationState.Released)
{
position.Y = position.Y + speed;
}
}
Can you help me guys, I can`t create a touch event of my game. Thank in
Advance :)
TouchCollection touchCollection = TouchPanel.GetState();
foreach (TouchLocation tl in touchCollection)
{
if (tl.State == TouchLocationState.Pressed)
{
position.Y = position.Y - speed;
}
if (tl.State == TouchLocationState.Released)
{
position.Y = position.Y + speed;
}
}
Can you help me guys, I can`t create a touch event of my game. Thank in
Advance :)
Meaning of Log f0 delta
Meaning of Log f0 delta
I am just walking through a really long section of code that I need to
rework for a company. I have to re-write it in a different language.
This code deals with calculating "log f0 delta". This has something to do
with audio and a pitch curve.
My question would be: Does anybody know from just hearing this topic what
is done there? The code is REALLY huge, and I would really like to
understand what exactely is calculated there before I re-write it. That
would make it easier for me.
Thank you very much for the help!
I am just walking through a really long section of code that I need to
rework for a company. I have to re-write it in a different language.
This code deals with calculating "log f0 delta". This has something to do
with audio and a pitch curve.
My question would be: Does anybody know from just hearing this topic what
is done there? The code is REALLY huge, and I would really like to
understand what exactely is calculated there before I re-write it. That
would make it easier for me.
Thank you very much for the help!
Subscribe to:
Posts (Atom)