open-license-manager
2014-09-08 28c330ab959471bb68d8b230f8c989a9ac676404
logs
2个文件已修改
21 ■■■■ 已修改文件
src/library/base/logger.h 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/library/os/win/os-win.c 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/library/base/logger.h
@@ -4,6 +4,8 @@
#ifndef LOG_ENABLED
#ifdef NDEBUG
#define LOG_DEBUG(M, ...) _log("[INFO] %s (%s:%d) " M "\n", __FILE__, __LINE__, ##__VA_ARGS__)
#else
#define LOG_DEBUG(M,...)
#endif
#define LOG_INFO(M, ...) _log("[INFO] %s (%s:%d) " M "\n", __FILE__, __LINE__, ##__VA_ARGS__)
#define LOG_WARN(M, ...) _log("[WARN] %s (%s:%d: errno: %s) " M "\n", __FILE__, __LINE__, clean_errno(), ##__VA_ARGS__)
src/library/os/win/os-win.c
@@ -1,5 +1,6 @@
#include <Windows.h>
#include <iphlpapi.h>
#include "../../base/logger.h"
#include"../os.h"
#pragma comment(lib, "IPHLPAPI.lib")
@@ -51,13 +52,11 @@
                success = GetVolumeInformation(szSingleDrive, volName, MAX_PATH, &volSerial,
                    &FileMaxLen, &FileFlags, FileSysName, MAX_PATH);
                if (success) {
#ifdef _DEBUG
                    printf("drive         : %s\n", szSingleDrive);
                    printf("Volume Name   : %s\n", volName);
                    printf("Volume Serial : 0x%x\n", volSerial);
                    printf("Max file length : %d\n", FileMaxLen);
                    printf("Filesystem      : %s\n", FileSysName);
#endif
                    LOG_INFO("drive         : %s\n", szSingleDrive);
                    LOG_INFO("Volume Name   : %s\n", volName);
                    LOG_INFO("Volume Serial : 0x%x\n", volSerial);
                    LOG_DEBUG("Max file length : %d\n", FileMaxLen);
                    LOG_DEBUG("Filesystem      : %s\n", FileSysName);
                    if (diskInfos != NULL && * disk_info_size<ndrives){
                        strncpy(diskInfos[ndrives].device,volName,MAX_PATH);
                        strncpy(diskInfos[ndrives].label, FileSysName , MAX_PATH);
@@ -68,12 +67,10 @@
                    ndrives++;
                }
                else {
                    printf("Unable to retreive information of '%s'\n", szSingleDrive);
                    LOG_WARN("Unable to retrieve information of '%s'\n", szSingleDrive);
                }
            }
#ifdef _DEBUG
            printf("This volume is not a fixed disk : %s\n", szSingleDrive);
#endif
            LOG_INFO("This volume is not fixed : %s, type: %d\n", szSingleDrive);
            szSingleDrive += strlen(szSingleDrive) + 1;
        }
    }