50% OFF!!!

Showing posts with label windows. Show all posts
Showing posts with label windows. Show all posts

Monday, February 24, 2020

Skype | stuck on loading screen [SOLVED] [SOLUTION]

Hello!

This thread is about a sign-in problem of SKYPE version 8.56.0.103,
where the application is stuck on loading screen.
here:


Here is how I've solved the problem!

I'm working at the moment with windows7,
but i assume that the solution will work for any windows version.

Step1:
make sure you have your Skype username/password saved,
as you will need to re-login later on.

Step2:
Make sure Skype on your desktop is closed. (if not - close/quit)

Step3:
Open your appdata Local folder:
C:\Users\YourUserNameHere\AppData\Roaming

alternative for opening the folder:
- search on windows start search for %appdata%
- click on Roaming 

  




Step4:
On the Roaming folder, Enter Microsoft folder,
Find Skype for Desktop folder, and rename it to "___skype"
(just to have backup)
Step5:
Just restart your skype and everything works :)

Let me know. 
:)
:)







Wednesday, January 2, 2013

NSIS - Launch a program as user from UAC elevated installer

NSIS - Launch a program as user from UAC elevated installer
==========================================

I noticed that if a program is running as UAC elevated (admin or high user privileges), 
any opening process by this process will get the same privileges as the executing program,
which means, that any process opened by this UAC elevated program will be elevated also.

I found a solution for it, for opening the process UN-ELEVATED from ELEVATED running program.
I show this information as for NSIS installer, but can be used in ANY development environment (C#, NSIS, C++, JAVA, VB, and any).

The idea is to run the process in UN-ELEVATED mode, using windows's file explorer process `explorer.exe` (info).
Lets say the process that we want to launch is on `$TEMP\MyUnElevatedProcess.exe`.
So, for NSIS code, I will just write:

Exec '"$WINDIR\explorer.exe" "$TEMP\MyUnElevatedProcess.exe"'

And this will do the work...
The process `MyUnElevatedProcess.exe` will run with same ELEVATION that have your windows login, as have `$WINDIR\explorer.exe`.


Execute with parameters:
In addition, if the UN-ELEVATED process need to executed with parameters, you will need to create another file that executes the UN-ELEVATED process (for example a BATCH file which just run the process with the command line parameters).
a good example can be:
; assuming that the file `MyUnElevatedProcess.exe` exists on `$TEMP\`

; create shortcut with ARGUMENTS
CreateShortCut "$TEMP\Shortcut.lnk" "$TEMP\MyUnElevatedProcess.exe" "/arg1 /arg2 /arg3"

; execute the file NON elevated
Exec '"$WINDIR\explorer.exe" "$TEMP\Shortcut.lnk"'


Remember,
if your main program (the executing), is not ELEVATED, this logic is not relevant, because then you can just run `Exec` (open-process function in NSIS) which will have the same elevation as your process.

I hope it helps,
MDB-BLOG

Sunday, May 22, 2011

c# WinForm | Check form window size and location

Hello,


I wanted to open a new window form, exactly near another form. (pinning one form to another).
Because of the border difference among Windows XP, Vista and Windows7 (win7), it didn't work easily.

So to determine windows size under win7/vista, I had to check if Windows Aero. (checking made by short&easy code)

Now, after checking this, I had to also support winXP (which does not have AERO technology).

For finding the left and right window border size (width) I used the SystemInformation Class which provides information about the current system environment.

Note:
I recommend to check if it works for other FormBorderStyle.

The code:
internal static bool IsAeroEnabled()
{
    bool isEnabled = false;
    if (Environment.OSVersion.Version.Major >= 6)
    {
        try
        {
            DwmIsCompositionEnabled(out isEnabled);
        }
        catch (Exception ex)
        {
            Logger.WriteLog(ex);
        }
    }
    return isEnabled;
}
[DllImport("dwmapi.dll")]
internal static extern int DwmIsCompositionEnabled(out bool enabled);

Best regard,
MDB Blog

Monday, May 2, 2011

Check HOSTS file - C# WinForms

Hello,

In today's post i'm giving a good (and simple) anti-hacking tool which allow your application to CHECK for any changes in the Windows HOSTS file.

So, the operation is simple:
Just read the hosts file content, and validate that your site DNS is not included in the list.
[basiclly, check if hosts file contains your dns name]
if so, the user probably is trying to bypass your server so you can stop him from doing so.

The code:
static bool IsDnsByPassed(string p_dnsName)
{
    string path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.System), @"drivers\etc\hosts");
    string hostsText = File.ReadAllText(path);
    return hostsText.ToLower().Contains(p_dnsName.ToLower());
}

Note:
Although reading the HOSTS file is allowed to all user, do not try to edit the HOSTS file, because on Vista & Windows7 this operation is allowed only for administrators. if your application is NOT running as Admin, then you won't have permission for this (and an Exception will be thrown).

Best regard,
MDB-Blog

Wednesday, December 8, 2010

C# | Check if app is installed for “All users” or "Just me"


Today I bring a very HARD-to-find topic about getting an installed application "Installation context".
An installation context may be Per-Machine Installation Context (ALLUSERS=1) and Per-User Installation Context (ALLUSERS="").

When installing an application, the user may select one of two options:
a. Install [APP] for yourself
b. or for anyone who uses this computer

[a] installs only for the current user(just me) while [b] installs for the Local System user which is for all-users(everyone).

In this post I will give a code for checking is an installed application was installed for "Everyone" or "Just me".

The validation process is check if the APPLICATION-NAME exists in the registry keys under UserData.
(*) Everyone - check under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\ (S-1-5-18 represents the Local System user)

(*) Just me (Current user) - check under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-?!?!?!?!\Products\ (S-?!?!?!?! represents the Current user. this value found by the code: WindowsIdentity.GetCurrent().User.Value.


[Code] Method's return type:
private enum InstallationContexts { NotInstalled, Everyone, JustMe };

[Code] Method declaration:
private InstallationContexts GetInstalledContext(string p_appDisplayName)
{
    //The S-1-5-18  =
Local System user (Everyone) | HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\

    //The S-XXXXXX  =
Current user (Just me)       |
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-?!?!?!?!\Products\

    string key;
    string keyFormat = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\{0}\Products\";
 
    // Check if installed for -> Everyone
    key = string.Format(keyFormat, "S-1-5-18");
    bool res = GetInstalledContext_IsRegKeyExists(key, p_appDisplayName, StringComparison.OrdinalIgnoreCase);
    if (res == true)
    {
        return InstallationContexts.Everyone;
    }
 
    // Check if installed for -> Just me
    key = string.Format(keyFormat, WindowsIdentity.GetCurrent().User.Value);
    res = GetInstalledContext_IsRegKeyExists(key, p_appDisplayName, StringComparison.OrdinalIgnoreCase);
    if (res == true)
    {
        return InstallationContexts.JustMe;
    }
 
    return InstallationContexts.NotInstalled;
}
private bool GetInstalledContext_IsRegKeyExists(string p_regKey, string p_appDisplayName, StringComparison p_scompare)
{
    using (RegistryKey regkey = Registry.LocalMachine.OpenSubKey(p_regKey))
    {
        if (regkey != null)
        {
            RegistryKey rk;
            string[] arrProducs = regkey.GetSubKeyNames();
            for (int i = 0; i < arrProducs.Length; i++)
            {

               using (rk = regkey.OpenSubKey(arrProducs[i] + @"\InstallProperties"))
               {
if (rk != null &&
                        p_appDisplayName.Equals(rk.GetValue("DisplayName").ToString(), p_scompare) == true)
                   {
                        return true;
                   }
               }
            }
        }
    }
 
    return false;
}

[Code] Method's usage example:
InstallationContexts appContext = GetInstalledContext("APP-DISPLAY-NAME");

This code gives the ability to detect previously installed application or previously installed software is installed to ALLUSERS (everyone) or only to CURRENT USER (just me).



Addition on 19.12.2010:
(*) This checking operation is valid ONLY for an application and software which were installed using Microsoft's Windows Installer.
For general checking for installed application, check my post about check if program/application is installed.


Enjoy...
MDB-Blog

Tuesday, November 23, 2010

How to determine the Windows version by using Visual C# | windows 7 windows vista

Here is a good code includes Windows 7 and Windows Vista recognaizer.

Code:
 
 
 
 
internal enum WindowsVersions { UnKnown, Win95, Win98, WinMe, WinNT3or4, Win2000, WinXP, WinServer2003, WinVista, Win7, Win8, MacOSX, Unix, Xbox };
internal static WindowsVersions GetCurrentWindowsVersion()
{
    // Get OperatingSystem information from the system namespace.
    System.OperatingSystem osInfo = System.Environment.OSVersion;
 
    // Determine the platform.
    if (osInfo.Platform == System.PlatformID.Win32Windows)
    {
        // Platform is Windows 95, Windows 98, Windows 98 Second Edition, or Windows Me.
        switch (osInfo.Version.Minor)
        {
            case 0:
                //Console.WriteLine("Windows 95");
                return WindowsVersions.Win95;
 
            case 10:
                //if (osInfo.Version.Revision.ToString() == "2222A")
                //    Console.WriteLine("Windows 98 Second Edition");
                //else
                //    Console.WriteLine("Windows 98");
                return WindowsVersions.Win98;
 
            case 90:
                //Console.WriteLine("Windows Me");
                return WindowsVersions.WinMe;
        }
    }
    else if (osInfo.Platform == System.PlatformID.Win32NT)
    {
        // Platform is Windows NT 3.51, Windows NT 4.0, Windows 2000, or Windows XP.
        switch (osInfo.Version.Major)
        {
            case 3:
            case 4:
                //Console.WriteLine("Windows NT 3.51"); // = 3
                //Console.WriteLine("Windows NT 4.0");  // = 4
                return WindowsVersions.WinNT3or4;
 
            case 5:
                switch (osInfo.Version.Minor)
                {
                    case 0:
                        //name = "Windows 2000";
                        return WindowsVersions.Win2000;
                    case 1:
                        //name = "Windows XP";
                        return WindowsVersions.WinXP;
                    case 2:
                        //name = "Windows Server 2003";
                        return WindowsVersions.WinServer2003;
                }
                break;
 
            case 6:
                switch (osInfo.Version.Minor)
                {
                    case 0:
                        // Windows Vista or Windows Server 2008 (distinct by rpoduct type)
                        return WindowsVersions.WinVista;
 
                    case 1:
                        return WindowsVersions.Win7;
 
                    case 2:
                        return WindowsVersions.Win8;
                }
                break;
        }
    }
    else if (osInfo.Platform == System.PlatformID.Unix)
    {
        return WindowsVersions.Unix;
    }
    else if (osInfo.Platform == System.PlatformID.MacOSX)
    {
        return WindowsVersions.MacOSX;
    }
    else if (osInfo.Platform == PlatformID.Xbox)
    {
        return WindowsVersions.Xbox;
    }
    return WindowsVersions.UnKnown;
}
 
 
 
 
 
2013/07/02: added WIN8 support
 

Wednesday, September 1, 2010

C# | check if program/application is installed

I searched for a code that getting the list of installed application/programs on my windows pc, but the result wat not satisfying.
I saw that the list of installed programs that i find is NOT like the "Add-Remove Programs" list!!!
The solution is to search for 3 places in registry:
1. SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall inside CurrentUser
2. SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall inside LocalMachine
3. SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall in LocalMachine
And this is my solution...

The Code:
public static bool IsApplictionInstalled(string p_name)
{
    string displayName;
    RegistryKey key;

    // search in: CurrentUser
    key = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall");
    foreach (String keyName in key.GetSubKeyNames())
    {
        RegistryKey subkey = key.OpenSubKey(keyName);
        displayName = subkey.GetValue("DisplayName") as string;
        if (p_name.Equals(displayName, StringComparison.OrdinalIgnoreCase) == true)
        {
            return true;
        }
    }

    // search in: LocalMachine_32
    key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall");
    foreach (String keyName in key.GetSubKeyNames())
    {
        RegistryKey subkey = key.OpenSubKey(keyName);
        displayName = subkey.GetValue("DisplayName") as string;
        if (p_name.Equals(displayName, StringComparison.OrdinalIgnoreCase) == true)
        {
            return true;
        }
    }

    // search in: LocalMachine_64
    key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall");
    foreach (String keyName in key.GetSubKeyNames())
    {
        RegistryKey subkey = key.OpenSubKey(keyName);
        displayName = subkey.GetValue("DisplayName") as string;
        if (p_name.Equals(displayName, StringComparison.OrdinalIgnoreCase) == true)
        {
            return true;
        }
    }

    // NOT FOUND
    return false;
}

This is great for searching for installed / uninstall programs.
I would like for some comments...

Monday, January 12, 2009

Javascript | Restrict number of open windows



Javascript Restrict number of open windows

here is a javascript code which allows:

  • Check if window is open
  • List open windows
  • Manage 5 open windows (Any amount)
  • Open restricted num. of windows.







function openWindowMAX5(p_url)
{
var win_I;
for(var i=0; i<5; i++)
{
win_I = window.open('', 'win_' + i);
if (win_I.document.location.href == 'about:blank')
{
window.status = 'win_'+i;
win_I = window.open(p_url, 'win_' + i);
break;
}
}
event.returnValue = false;
return false;
}


Used html code:
Open on new window

Tested on:

Working: IE7, CHROME 1.0.154

Not Working: Mozilla Firefox 3.0